mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-01-10 11:57:28 -03:00
gui: fix coin control input size accounting for taproot spends
This commit is contained in:
parent
54bdb6e074
commit
00a52e6394
1 changed files with 13 additions and 1 deletions
|
@ -421,7 +421,19 @@ void CoinControlDialog::updateLabels(CCoinControl& m_coin_control, WalletModel *
|
|||
std::vector<unsigned char> witnessprogram;
|
||||
if (out.txout.scriptPubKey.IsWitnessProgram(witnessversion, witnessprogram))
|
||||
{
|
||||
nBytesInputs += (32 + 4 + 1 + (107 / WITNESS_SCALE_FACTOR) + 4);
|
||||
// add input skeleton bytes (outpoint, scriptSig size, nSequence)
|
||||
nBytesInputs += (32 + 4 + 1 + 4);
|
||||
|
||||
if (witnessversion == 0) { // P2WPKH
|
||||
// 1 WU (witness item count) + 72 WU (ECDSA signature with len byte) + 34 WU (pubkey with len byte)
|
||||
nBytesInputs += 107 / WITNESS_SCALE_FACTOR;
|
||||
} else if (witnessversion == 1) { // P2TR key-path spend
|
||||
// 1 WU (witness item count) + 65 WU (Schnorr signature with len byte)
|
||||
nBytesInputs += 66 / WITNESS_SCALE_FACTOR;
|
||||
} else {
|
||||
// not supported, should be unreachable
|
||||
throw std::runtime_error("Trying to spend future segwit version script");
|
||||
}
|
||||
fWitness = true;
|
||||
}
|
||||
else if(ExtractDestination(out.txout.scriptPubKey, address))
|
||||
|
|
Loading…
Reference in a new issue