Sign the genesis when signing transactions

Prevents replaying across tributaries, which is a risk for BTC/ETH (regarding key gen).
This commit is contained in:
Luke Parker
2023-04-11 19:03:36 -04:00
parent 7488d23e0d
commit 4d17b922fe
2 changed files with 48 additions and 13 deletions

View File

@@ -89,6 +89,7 @@ impl<T: Transaction> Block<T> {
pub fn verify(
&self,
genesis: [u8; 32],
last_block: [u8; 32],
locally_provided: &mut HashSet<[u8; 32]>,
next_nonces: &mut HashMap<<Ristretto as Ciphersuite>::G, u32>,
@@ -99,7 +100,7 @@ impl<T: Transaction> Block<T> {
let mut txs = Vec::with_capacity(self.transactions.len());
for tx in &self.transactions {
match verify_transaction(tx, locally_provided, next_nonces) {
match verify_transaction(tx, genesis, locally_provided, next_nonces) {
Ok(()) => {}
Err(e) => Err(BlockError::TransactionError(e))?,
}