Document some consensus-critical finalized state behaviour (#2476)
* Document the new genesis transaction consensus rule Zebra previously implemented this rule, but we documented it as a bug in `zcashd`. * Document the actual behaviour of zs_insert
This commit is contained in:
parent
ccf93cf5c6
commit
82696b150b
|
|
@ -246,9 +246,10 @@ impl FinalizedState {
|
||||||
|
|
||||||
// TODO: sprout and sapling anchors (per block)
|
// TODO: sprout and sapling anchors (per block)
|
||||||
|
|
||||||
// Consensus-critical bug in zcashd: transactions in the
|
// "A transaction MUST NOT spend an output of the genesis block coinbase transaction.
|
||||||
// genesis block are ignored.
|
// (There is one such zero-valued output, on each of Testnet and Mainnet .)"
|
||||||
if block.header.previous_block_hash == block::Hash([0; 32]) {
|
// https://zips.z.cash/protocol/protocol.pdf#txnconsensus
|
||||||
|
if block.header.previous_block_hash == GENESIS_PREVIOUS_BLOCK_HASH {
|
||||||
return batch;
|
return batch;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -258,7 +259,6 @@ impl FinalizedState {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Index each transaction, spent inputs, nullifiers
|
// Index each transaction, spent inputs, nullifiers
|
||||||
// TODO: move computation into FinalizedBlock as with transparent outputs
|
|
||||||
for (transaction_index, (transaction, transaction_hash)) in block
|
for (transaction_index, (transaction, transaction_hash)) in block
|
||||||
.transactions
|
.transactions
|
||||||
.iter()
|
.iter()
|
||||||
|
|
|
||||||
|
|
@ -235,7 +235,8 @@ impl IntoDisk for transparent::OutPoint {
|
||||||
/// Helper trait for inserting (Key, Value) pairs into rocksdb with a consistently
|
/// Helper trait for inserting (Key, Value) pairs into rocksdb with a consistently
|
||||||
/// defined format
|
/// defined format
|
||||||
pub trait DiskSerialize {
|
pub trait DiskSerialize {
|
||||||
/// Serialize and insert the given key and value into a rocksdb column family.
|
/// Serialize and insert the given key and value into a rocksdb column family,
|
||||||
|
/// overwriting any existing `value` for `key`.
|
||||||
fn zs_insert<K, V>(&mut self, cf: &rocksdb::ColumnFamily, key: K, value: V)
|
fn zs_insert<K, V>(&mut self, cf: &rocksdb::ColumnFamily, key: K, value: V)
|
||||||
where
|
where
|
||||||
K: IntoDisk + Debug,
|
K: IntoDisk + Debug,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue