For #3546. Improve estimated tx size for Sapling outputs.
This commit is contained in:
@@ -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.
|
// Depending on the input notes, the actual tx size may turn out to be larger and perhaps invalid.
|
||||||
size_t txsize = 0;
|
size_t txsize = 0;
|
||||||
for (int i = 0; i < zaddrRecipients.size(); i++) {
|
for (int i = 0; i < zaddrRecipients.size(); i++) {
|
||||||
// TODO Check whether the recipient is a Sprout or Sapling address
|
auto address = std::get<0>(zaddrRecipients[i]);
|
||||||
JSDescription jsdesc;
|
auto res = DecodePaymentAddress(address);
|
||||||
|
bool toSapling = boost::get<libzcash::SaplingPaymentAddress>(&res) != nullptr;
|
||||||
if (mtx.fOverwintered && (mtx.nVersion >= SAPLING_TX_VERSION)) {
|
if (toSapling) {
|
||||||
jsdesc.proof = GrothProof();
|
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);
|
CTransaction tx(mtx);
|
||||||
txsize += GetSerializeSize(tx, SER_NETWORK, tx.nVersion);
|
txsize += GetSerializeSize(tx, SER_NETWORK, tx.nVersion);
|
||||||
|
|||||||
Reference in New Issue
Block a user