diff --git a/bitcoin/src/bip152.rs b/bitcoin/src/bip152.rs index 57819779..ee46d947 100644 --- a/bitcoin/src/bip152.rs +++ b/bitcoin/src/bip152.rs @@ -392,7 +392,11 @@ mod test { sequence: Sequence(1), witness: Witness::new(), }], - output: vec![TxOut { value: Amount::ONE_SAT, script_pubkey: ScriptBuf::new() }], + output: vec![TxOut { + value: Amount::ONE_SAT, + script_pubkey: ScriptBuf::new(), + unused_token_id: 0, + }], } } @@ -404,7 +408,10 @@ mod test { merkle_root: TxMerkleNode::hash(&[1]), time: 2, bits: CompactTarget::from_consensus(3), - nonce: 4, + deprecated_height: 0, + minted_blocks: 0, + sig: Vec::new(), + stake_modifier: [0u8; 32], }, txdata: vec![dummy_tx(&[2]), dummy_tx(&[3]), dummy_tx(&[4])], } diff --git a/bitcoin/src/blockdata/block.rs b/bitcoin/src/blockdata/block.rs index ee2ff518..365816b4 100644 --- a/bitcoin/src/blockdata/block.rs +++ b/bitcoin/src/blockdata/block.rs @@ -526,7 +526,6 @@ mod tests { assert_eq!(serialize(&real_decode.header.merkle_root), merkle); assert_eq!(real_decode.header.time, 1231965655); assert_eq!(real_decode.header.bits, CompactTarget::from_consensus(486604799)); - assert_eq!(real_decode.header.nonce, 2067413810); assert_eq!(real_decode.header.work(), work); assert_eq!( real_decode.header.validate_pow(real_decode.header.target()).unwrap(), @@ -569,7 +568,6 @@ mod tests { assert_eq!(real_decode.header.merkle_root, real_decode.compute_merkle_root().unwrap()); assert_eq!(real_decode.header.time, 1472004949); assert_eq!(real_decode.header.bits, CompactTarget::from_consensus(0x1a06d450)); - assert_eq!(real_decode.header.nonce, 1879759182); assert_eq!(real_decode.header.work(), work); assert_eq!( real_decode.header.validate_pow(real_decode.header.target()).unwrap(), diff --git a/bitcoin/src/blockdata/constants.rs b/bitcoin/src/blockdata/constants.rs index 69fdcca7..713e43c5 100644 --- a/bitcoin/src/blockdata/constants.rs +++ b/bitcoin/src/blockdata/constants.rs @@ -248,7 +248,6 @@ mod test { assert_eq!(gen.header.time, 1231006505); assert_eq!(gen.header.bits, CompactTarget::from_consensus(0x1d00ffff)); - assert_eq!(gen.header.nonce, 2083236893); assert_eq!( gen.header.block_hash().to_string(), "000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f" @@ -266,7 +265,6 @@ mod test { ); assert_eq!(gen.header.time, 1296688602); assert_eq!(gen.header.bits, CompactTarget::from_consensus(0x1d00ffff)); - assert_eq!(gen.header.nonce, 414098458); assert_eq!( gen.header.block_hash().to_string(), "000000000933ea01ad0ee984209779baaec3ced90fa3f408719526f8d77f4943" @@ -284,7 +282,6 @@ mod test { ); assert_eq!(gen.header.time, 1598918400); assert_eq!(gen.header.bits, CompactTarget::from_consensus(0x1e0377ae)); - assert_eq!(gen.header.nonce, 52613770); assert_eq!( gen.header.block_hash().to_string(), "00000008819873e925422c1ff0f99f7cc9bbb232af63a077a480a3633bee1ef6" diff --git a/bitcoin/src/crypto/sighash.rs b/bitcoin/src/crypto/sighash.rs index 6fb2ddbe..8847bd3e 100644 --- a/bitcoin/src/crypto/sighash.rs +++ b/bitcoin/src/crypto/sighash.rs @@ -1753,7 +1753,11 @@ mod tests { .given .utxos_spent .into_iter() - .map(|txo| TxOut { value: txo.value, script_pubkey: txo.script_pubkey }) + .map(|txo| TxOut { + value: txo.value, + script_pubkey: txo.script_pubkey, + unused_token_id: 0, + }) .collect::>(); // Test intermediary diff --git a/bitcoin/src/psbt/mod.rs b/bitcoin/src/psbt/mod.rs index 925ea413..870384f3 100644 --- a/bitcoin/src/psbt/mod.rs +++ b/bitcoin/src/psbt/mod.rs @@ -1046,6 +1046,7 @@ mod tests { witness: Witness::default(), }], output: vec![TxOut { + unused_token_id: 0, value: Amount::from_sat(output), script_pubkey: ScriptBuf::from_hex( "a9143545e6e33b832c47050f24d3eeb93c9c03948bc787", @@ -1060,6 +1061,7 @@ mod tests { inputs: vec![Input { witness_utxo: Some(TxOut { + unused_token_id: 0, value: Amount::from_sat(input), script_pubkey: ScriptBuf::from_hex( "a914339725ba21efd62ac753a9bcd067d6c7a6a39d0587", @@ -1207,6 +1209,7 @@ mod tests { }], output: vec![ TxOut { + unused_token_id: 0, value: Amount::from_sat(99_999_699), script_pubkey: ScriptBuf::from_hex( "76a914d0c59903c5bac2868760e90fd521a4665aa7652088ac", @@ -1214,6 +1217,7 @@ mod tests { .unwrap(), }, TxOut { + unused_token_id: 0, value: Amount::from_sat(100_000_000), script_pubkey: ScriptBuf::from_hex( "a9143545e6e33b832c47050f24d3eeb93c9c03948bc787", @@ -1280,6 +1284,7 @@ mod tests { )]), }], output: vec![TxOut { + unused_token_id: 0, value: Amount::from_sat(190_303_501_938), script_pubkey: ScriptBuf::from_hex( "a914339725ba21efd62ac753a9bcd067d6c7a6a39d0587", @@ -1331,6 +1336,7 @@ mod tests { Input { non_witness_utxo: Some(tx), witness_utxo: Some(TxOut { + unused_token_id: 0, value: Amount::from_sat(190_303_501_938), script_pubkey: ScriptBuf::from_hex("a914339725ba21efd62ac753a9bcd067d6c7a6a39d0587").unwrap(), }), @@ -1466,10 +1472,12 @@ mod tests { ], output: vec![ TxOut { + unused_token_id: 0, value: Amount::from_sat(99_999_699), script_pubkey: ScriptBuf::from_hex("76a914d0c59903c5bac2868760e90fd521a4665aa7652088ac").unwrap(), }, TxOut { + unused_token_id: 0, value: Amount::from_sat(100_000_000), script_pubkey: ScriptBuf::from_hex("a9143545e6e33b832c47050f24d3eeb93c9c03948bc787").unwrap(), }, @@ -1513,10 +1521,12 @@ mod tests { ], output: vec![ TxOut { + unused_token_id: 0, value: Amount::from_sat(200_000_000), script_pubkey: ScriptBuf::from_hex("76a91485cff1097fd9e008bb34af709c62197b38978a4888ac").unwrap(), }, TxOut { + unused_token_id: 0, value: Amount::from_sat(190_303_501_938), script_pubkey: ScriptBuf::from_hex("a914339725ba21efd62ac753a9bcd067d6c7a6a39d0587").unwrap(), }, @@ -1798,10 +1808,12 @@ mod tests { ], output: vec![ TxOut { + unused_token_id: 0, value: Amount::from_sat(99_999_699), script_pubkey: ScriptBuf::from_hex("76a914d0c59903c5bac2868760e90fd521a4665aa7652088ac").unwrap(), }, TxOut { + unused_token_id: 0, value: Amount::from_sat(100_000_000), script_pubkey: ScriptBuf::from_hex("a9143545e6e33b832c47050f24d3eeb93c9c03948bc787").unwrap(), }, @@ -1845,10 +1857,12 @@ mod tests { ], output: vec![ TxOut { + unused_token_id: 0, value: Amount::from_sat(200_000_000), script_pubkey: ScriptBuf::from_hex("76a91485cff1097fd9e008bb34af709c62197b38978a4888ac").unwrap(), }, TxOut { + unused_token_id: 0, value: Amount::from_sat(190_303_501_938), script_pubkey: ScriptBuf::from_hex("a914339725ba21efd62ac753a9bcd067d6c7a6a39d0587").unwrap(), }, @@ -1966,10 +1980,12 @@ mod tests { ], output: vec![ TxOut { + unused_token_id: 0, value: output_0_val, script_pubkey: ScriptBuf::new() }, TxOut { + unused_token_id: 0, value: output_1_val, script_pubkey: ScriptBuf::new() }, @@ -2005,10 +2021,12 @@ mod tests { ], output: vec![ TxOut { + unused_token_id: 0, value: prev_output_val, script_pubkey: ScriptBuf::new() }, TxOut { + unused_token_id: 0, value: Amount::from_sat(190_303_501_938), script_pubkey: ScriptBuf::new() }, diff --git a/bitcoin/tests/psbt.rs b/bitcoin/tests/psbt.rs index 7ad4bda5..eb33d480 100644 --- a/bitcoin/tests/psbt.rs +++ b/bitcoin/tests/psbt.rs @@ -183,12 +183,14 @@ fn create_transaction() -> Transaction { ], output: vec![ TxOut { + unused_token_id: 0, value: Amount::from_str_in(output_0.amount, Denomination::Bitcoin) .expect("failed to parse amount"), script_pubkey: ScriptBuf::from_hex(output_0.script_pubkey) .expect("failed to parse script"), }, TxOut { + unused_token_id: 0, value: Amount::from_str_in(output_1.amount, Denomination::Bitcoin) .expect("failed to parse amount"), script_pubkey: ScriptBuf::from_hex(output_1.script_pubkey) diff --git a/bitcoin/tests/serde.rs b/bitcoin/tests/serde.rs index 329af982..c62bb382 100644 --- a/bitcoin/tests/serde.rs +++ b/bitcoin/tests/serde.rs @@ -111,6 +111,7 @@ fn serde_regression_txin() { #[test] fn serde_regression_txout() { let txout = TxOut { + unused_token_id: 0, value: Amount::from_sat(0xDEADBEEFCAFEBABE), script_pubkey: ScriptBuf::from(vec![0u8, 1u8, 2u8]), }; @@ -239,6 +240,7 @@ fn serde_regression_psbt() { .unwrap()]), }], output: vec![TxOut { + unused_token_id: 0, value: Amount::from_sat(190_303_501_938), script_pubkey: ScriptBuf::from_hex("a914339725ba21efd62ac753a9bcd067d6c7a6a39d0587") .unwrap(), @@ -284,6 +286,7 @@ fn serde_regression_psbt() { inputs: vec![Input { non_witness_utxo: Some(tx), witness_utxo: Some(TxOut { + unused_token_id: 0, value: Amount::from_sat(190_303_501_938), script_pubkey: ScriptBuf::from_hex("a914339725ba21efd62ac753a9bcd067d6c7a6a39d0587").unwrap(), }),