From 08bb57e4995602fef5c5b771c98a76b98a7bb652 Mon Sep 17 00:00:00 2001 From: "Tobin C. Harding" Date: Fri, 24 Jan 2025 09:17:24 +1100 Subject: [PATCH 1/2] Use MAX_MONEY in serde regression test We plan on enforcing MAX_MONEY in the amount types. In preparation use MAX_MONEY in the serde regression test instead of the arbitrary, and too large DEADBEEFCAFEBABE value. --- bitcoin/tests/data/serde/txout_bincode | Bin 19 -> 19 bytes bitcoin/tests/serde.rs | 6 ++---- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/bitcoin/tests/data/serde/txout_bincode b/bitcoin/tests/data/serde/txout_bincode index 2c3d2077743b014009c2f5b98d33fb263287c688..1bbd8c3317b4fed1310bbed89e13e21e313435ee 100644 GIT binary patch literal 19 UcmZQ@V2}Dx%Fe*d00oRp03V))yO`_|rLW`F`lCIDo527dqm diff --git a/bitcoin/tests/serde.rs b/bitcoin/tests/serde.rs index f28c878d5..807f838a6 100644 --- a/bitcoin/tests/serde.rs +++ b/bitcoin/tests/serde.rs @@ -109,10 +109,8 @@ fn serde_regression_txin() { #[test] fn serde_regression_txout() { - let txout = TxOut { - value: Amount::from_sat(0xDEADBEEFCAFEBABE), - script_pubkey: ScriptBuf::from(vec![0u8, 1u8, 2u8]), - }; + let txout = + TxOut { value: Amount::MAX_MONEY, script_pubkey: ScriptBuf::from(vec![0u8, 1u8, 2u8]) }; let got = serialize(&txout).unwrap(); let want = include_bytes!("data/serde/txout_bincode") as &[_]; assert_eq!(got, want) From 4dad4730a81f9f08a565f196e5699f054e28f977 Mon Sep 17 00:00:00 2001 From: "Tobin C. Harding" Date: Sat, 25 Jan 2025 06:51:26 +1100 Subject: [PATCH 2/2] Add unreleased changelog entry We want to be sure to mention the new MAX_MONEY invariant and the fact that we silently broke serde while doing it. --- bitcoin/CHANGELOG.md | 6 ++++++ units/CHANGELOG.md | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/bitcoin/CHANGELOG.md b/bitcoin/CHANGELOG.md index 203e3967b..368489009 100644 --- a/bitcoin/CHANGELOG.md +++ b/bitcoin/CHANGELOG.md @@ -1,3 +1,9 @@ +# Unreleased + +- TODO: Make a comment about `Amount::MAX_MONEY` (perhaps here in `bitcoin` release notes as well as in `amount`) + +- Use MAX_MONEY in serde regression test [#3950](https://github.com/rust-bitcoin/rust-bitcoin/pull/3950) + # 0.33.0-alpha.0 - 2024-11-18 This series of alpha releases is meant for two things: diff --git a/units/CHANGELOG.md b/units/CHANGELOG.md index dbb1bab81..c2f6a470f 100644 --- a/units/CHANGELOG.md +++ b/units/CHANGELOG.md @@ -1,3 +1,9 @@ +# Unreleased + +- TODO: Make a comment about `Amount::MAX_MONEY` including breaking serde + +- Use MAX_MONEY in serde regression test [#3950](https://github.com/rust-bitcoin/rust-bitcoin/pull/3950) + # 0.2.0 - 2024-09-18 * Bump MSRV to 1.63.0 [#3100](https://github.com/rust-bitcoin/rust-bitcoin/pull/3100)