Auto merge of #3567 - bitcartel:3546_estimate_tx_size, r=bitcartel
For #3546. Improve estimated tx size for Sapling outputs.
This commit is contained in:
commit
72f6925de1
|
@ -3786,14 +3786,18 @@ UniValue z_sendmany(const UniValue& params, bool fHelp)
|
|||
// Depending on the input notes, the actual tx size may turn out to be larger and perhaps invalid.
|
||||
size_t txsize = 0;
|
||||
for (int i = 0; i < zaddrRecipients.size(); i++) {
|
||||
// TODO Check whether the recipient is a Sprout or Sapling address
|
||||
JSDescription jsdesc;
|
||||
|
||||
if (mtx.fOverwintered && (mtx.nVersion >= SAPLING_TX_VERSION)) {
|
||||
jsdesc.proof = GrothProof();
|
||||
auto address = std::get<0>(zaddrRecipients[i]);
|
||||
auto res = DecodePaymentAddress(address);
|
||||
bool toSapling = boost::get<libzcash::SaplingPaymentAddress>(&res) != nullptr;
|
||||
if (toSapling) {
|
||||
mtx.vShieldedOutput.push_back(OutputDescription());
|
||||
} else {
|
||||
JSDescription jsdesc;
|
||||
if (mtx.fOverwintered && (mtx.nVersion >= SAPLING_TX_VERSION)) {
|
||||
jsdesc.proof = GrothProof();
|
||||
}
|
||||
mtx.vjoinsplit.push_back(jsdesc);
|
||||
}
|
||||
|
||||
mtx.vjoinsplit.push_back(jsdesc);
|
||||
}
|
||||
CTransaction tx(mtx);
|
||||
txsize += GetSerializeSize(tx, SER_NETWORK, tx.nVersion);
|
||||
|
|
Loading…
Reference in New Issue