Open ncying opened 6 years ago
Two ordering methods in Waves,
in waves v0.7.9 (Aug 14, 2017), they use sort 1 first and choose 100 valid txs, then use sort 2 to package the utxs.
start from waves v0.8.0 ( Oct 13, 2017), an extra parameter (sortInBlock) added to control the sort 2. if sortInBlock then return utxs with sort 2 else return utxs.reverse (tx +: valid is used to generate the utxs, so reverse is needed) https://github.com/wavesplatform/Waves/blob/00c59dd68ef19d8dcfc252909295f43c86ae4d50/src/main/scala/com/wavesplatform/UtxPool.scala#L124
the sortInBlock is defined as follows: sortInBlock = history.height() <= blockchainSettings.functionalitySettings.dontRequireSortedTransactionsAfter https://github.com/wavesplatform/Waves/blob/00c59dd68ef19d8dcfc252909295f43c86ae4d50/src/main/scala/com/wavesplatform/mining/Miner.scala#L104 dontRequireSortedTransactionsAfter: Long = blockVersion3After https://github.com/wavesplatform/Waves/blob/00c59dd68ef19d8dcfc252909295f43c86ae4d50/src/main/scala/com/wavesplatform/settings/BlockchainSettings.scala#L29 in waves v0.8.7 (Dec 7, 2017), this value fixed blockVersion3AfterHeight = 795000 https://github.com/wavesplatform/Waves/blob/de7f53841e6589354062f458e5d3ecdd72c8e902/src/main/scala/com/wavesplatform/settings/BlockchainSettings.scala#L50 before that blockVersion3AfterHeight = Long.MaxValue
from the blockVersion3, all new blocks will not use the sort 2, which means that the order of txs fixed.
a fixed transaction order can handle the blocks with reliant txs (ex. contend/release txs or smart contract txs)
thanks for documenting this!
reset the order by (feeScale, fee, timestamp, txType)
Two ordering methods in Waves,
in waves v0.7.9 (Aug 14, 2017), they use sort 1 first and choose 100 valid txs, then use sort 2 to package the utxs.
start from waves v0.8.0 ( Oct 13, 2017), an extra parameter (sortInBlock) added to control the sort 2. if sortInBlock then return utxs with sort 2 else return utxs.reverse (tx +: valid is used to generate the utxs, so reverse is needed) https://github.com/wavesplatform/Waves/blob/00c59dd68ef19d8dcfc252909295f43c86ae4d50/src/main/scala/com/wavesplatform/UtxPool.scala#L124
the sortInBlock is defined as follows: sortInBlock = history.height() <= blockchainSettings.functionalitySettings.dontRequireSortedTransactionsAfter https://github.com/wavesplatform/Waves/blob/00c59dd68ef19d8dcfc252909295f43c86ae4d50/src/main/scala/com/wavesplatform/mining/Miner.scala#L104 dontRequireSortedTransactionsAfter: Long = blockVersion3After https://github.com/wavesplatform/Waves/blob/00c59dd68ef19d8dcfc252909295f43c86ae4d50/src/main/scala/com/wavesplatform/settings/BlockchainSettings.scala#L29 in waves v0.8.7 (Dec 7, 2017), this value fixed blockVersion3AfterHeight = 795000 https://github.com/wavesplatform/Waves/blob/de7f53841e6589354062f458e5d3ecdd72c8e902/src/main/scala/com/wavesplatform/settings/BlockchainSettings.scala#L50 before that blockVersion3AfterHeight = Long.MaxValue
from the blockVersion3, all new blocks will not use the sort 2, which means that the order of txs fixed.
a fixed transaction order can handle the blocks with reliant txs (ex. contend/release txs or smart contract txs)