mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-01-25 10:43:19 -03:00
wallet: check solvability using descriptor in AvailableCoins
This is a workaround for Miniscript descriptors containing hash challenges. For those we can't mock the signature creator without making OP_EQUAL mockable in the interpreter, so CalculateMaximumInputSize will always return -1 and outputs for these descriptors would appear unsolvable while they actually are.
This commit is contained in:
parent
560e62b1e2
commit
0a8fc9e200
1 changed files with 1 additions and 3 deletions
|
@ -294,9 +294,7 @@ CoinsResult AvailableCoins(const CWallet& wallet,
|
|||
std::unique_ptr<SigningProvider> provider = wallet.GetSolvingProvider(output.scriptPubKey);
|
||||
|
||||
int input_bytes = CalculateMaximumSignedInputSize(output, COutPoint(), provider.get(), coinControl);
|
||||
// Because CalculateMaximumSignedInputSize just uses ProduceSignature and makes a dummy signature,
|
||||
// it is safe to assume that this input is solvable if input_bytes is greater -1.
|
||||
bool solvable = input_bytes > -1;
|
||||
bool solvable = provider ? InferDescriptor(output.scriptPubKey, *provider)->IsSolvable() : false;
|
||||
bool spendable = ((mine & ISMINE_SPENDABLE) != ISMINE_NO) || (((mine & ISMINE_WATCH_ONLY) != ISMINE_NO) && (coinControl && coinControl->fAllowWatchOnly && solvable));
|
||||
|
||||
// Filter by spendable outputs only
|
||||
|
|
Loading…
Add table
Reference in a new issue