-
Notifications
You must be signed in to change notification settings - Fork 92
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
client/asset/{btc,dcr}: support p2pk and fix unsupported btc utxos #1581
Conversation
if errors.Is(err, dex.UnsupportedScriptError) { | ||
continue | ||
} | ||
return nil, nil, 0, fmt.Errorf("error reading asset info: %w", err) | ||
} | ||
if nfo.ScriptType == dexbtc.ScriptUnsupported || nfo.NonStandardScript { | ||
// InputInfo sets NonStandardScript for P2SH with non-standard | ||
// redeem scripts. Don't return these since they cannot fund | ||
// arbitrary txns. | ||
continue | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This now mirror's DCR's client code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe add p2pk tracking in TestLiveUTXO
and LiveUTXOStats
?
That was a minor rabbit hole. I ended up fixing some bugs in the btc |
@@ -287,7 +287,7 @@ func (utxo *UTXO) Confirmations(context.Context) (int64, error) { | |||
// See if we can find the utxo in another block. | |||
newUtxo, err := utxo.btc.utxo(&utxo.tx.hash, utxo.vout, utxo.redeemScript) | |||
if err != nil { | |||
return -1, fmt.Errorf("utxo block is not mainchain") | |||
return -1, fmt.Errorf("utxo error: %w", err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
immature output
was one of the ones left after the bug fixes. Nothing to do with mainchain anyway. We might rethink the utxo
method a little because there is a maturity
field so I'm not sure it should error instead of deferring to the caller to decide if immature is a problem (server is probably checking funding coins or swap txns, so it does make sense, but in terms of general operation utxo
failing to provide a return for immature outputs even though it has a maturity field is strange)
I don't want to change it now though
66d06de
to
3b93791
Compare
This updates the DCR and BTC packages to understand P2PK outputs. This also fixes the BTC client packages UTXO conversion code so that unsupported output scripts in the listunspent result are merely skipped instead of breaking the ability to select UTXOs at all.
server/asset/doge: add BlockDeserializer
Addressing issues revealed in #1558 (comment)
This updates the DCR and BTC packages to understand P2PK outputs.
This also fixes the BTC client packages UTXO conversion code so that
unsupported output scripts in the listunspent result are merely skipped
instead of breaking the ability to select UTXOs at all.