Changeset View
Standalone View
src/primitives/transaction.cpp
Show First 20 Lines • Show All 109 Lines • ▼ Show 20 Lines | for (const auto &nVin : vin) { | ||||
if (nTxSize > offset) { | if (nTxSize > offset) { | ||||
nTxSize -= offset; | nTxSize -= offset; | ||||
} | } | ||||
} | } | ||||
return nTxSize; | return nTxSize; | ||||
} | } | ||||
size_t CTransaction::GetBillableSize() const { | size_t CTransaction::GetBillableSize() const { | ||||
return ::GetSerializeSize(*this, SER_NETWORK, PROTOCOL_VERSION); | |||||
size_t nTxSize = GetTotalSize(), inputs = vin.size(), outputs = vout.size(); | |||||
// 179 bytes is the minimum size it would take to spend any outputs which | |||||
// are created. We want to change in advance of spending them to | |||||
// incentivize keeping your UTXO set reasonbly sized. | |||||
int64_t modSize = | |||||
int64_t(nTxSize) + (int64_t(outputs) - int64_t(inputs)) * 1790; | |||||
jasonbcox: The comment refers to 179 bytes. Where does the `* 10` multiplier come from? I assume it's… | |||||
schancelAuthorUnsubmitted Done Inline ActionsYeah, sorry the comment was outdated when I dropped the fees to 100 sat/byte, I upped the total size of the UTXO to 1790. I don't really like this formula at all though. I want to discuss it more. schancel: Yeah, sorry the comment was outdated when I dropped the fees to 100 sat/byte, I upped the total… | |||||
// Note: It is impossible to generate a negative number above in any real | |||||
// world situation. This is because the inputs have a least 179 byte | |||||
// each. However, it is possible to have shorter scriptSigs than 179 | |||||
// bytes. Therefore, we include a minimum of 10 bytes + 34 * vouts. | |||||
nTxSize = std::max(int64_t(outputs * 34 + 10), modSize); | |||||
return nTxSize; | |||||
schancelAuthorUnsubmitted Done Inline ActionsI'm not sure the above calculation is ideal. Let's talk about what we want here. With the fees dropped, this makes a 1 input + 2 output transaction cost 1sat/byte roughly. However, I don't like the linear formula, and the 100% return rate when spending a UTXO. schancel: I'm not sure the above calculation is ideal. Let's talk about what we want here. With the… | |||||
jasonbcoxUnsubmitted Not Done Inline ActionsSince spending a UTXO doesn't increase the UTXO set size, we should be safe here. I think the linear formula will work for now and can be optimized as we continue to improve the mempool and other more critical paths. Incremental improvements :) jasonbcox: Since spending a UTXO doesn't increase the UTXO set size, we should be safe here. I think the… | |||||
schancelAuthorUnsubmitted Done Inline ActionsIt's pressure on the wallet ecosystem everytime this changes. schancel: It's pressure on the wallet ecosystem everytime this changes. | |||||
jasonbcoxUnsubmitted Not Done Inline ActionsIt should only be pressure on wallets if the minfee increases. Decreases in the acceptable minfee can be adopted by wallets at any time. jasonbcox: It should only be pressure on wallets if the minfee increases. Decreases in the acceptable… | |||||
} | } | ||||
unsigned int CTransaction::GetTotalSize() const { | unsigned int CTransaction::GetTotalSize() const { | ||||
return ::GetSerializeSize(*this, SER_NETWORK, PROTOCOL_VERSION); | return ::GetSerializeSize(*this, SER_NETWORK, PROTOCOL_VERSION); | ||||
} | } | ||||
std::string CTransaction::ToString() const { | std::string CTransaction::ToString() const { | ||||
std::string str; | std::string str; | ||||
Show All 12 Lines |
The comment refers to 179 bytes. Where does the * 10 multiplier come from? I assume it's derived from the 100 sat/kB value, but this calculation should derive from that as well.