Skip to content

Commit 84a075d

Browse files
committed
Merge rust-bitcoin#1796: transaction: Rename is_coin_base to is_coinbase
a54e1ce Apply rustfmt (The rustfmt Tyranny) 38d11ce ci: Make release CI search for NEXT.RELEASE instead (Steven Roose) dad3abd transaction: Rename is_coin_base to is_coinbase (Steven Roose) Pull request description: Alternative to rust-bitcoin#1795. Keep the old method as deprecated and add doc alias. Also change internal usage of the method. ACKs for top commit: tcharding: ACK a54e1ce apoelstra: ACK a54e1ce Tree-SHA512: 52d9729bf83da164556d960f8867cb836ff57a0f619da3dd3620efffb28a974aac23b8085863ab0e072a4bdb2f13ac576efa43ad2eec9a271ad044227f4d00a4
2 parents c744e24 + a54e1ce commit 84a075d

File tree

3 files changed

+11
-6
lines changed

3 files changed

+11
-6
lines changed

bitcoin/src/blockdata/block.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ impl Block {
220220
}
221221

222222
let coinbase = &self.txdata[0];
223-
if !coinbase.is_coin_base() {
223+
if !coinbase.is_coinbase() {
224224
return false;
225225
}
226226

bitcoin/src/blockdata/transaction.rs

+8-3
Original file line numberDiff line numberDiff line change
@@ -981,10 +981,15 @@ impl Transaction {
981981
/// transaction. It is impossible to check if the transaction is first in the block, so this
982982
/// function checks the structure of the transaction instead - the previous output must be
983983
/// all-zeros (creates satoshis "out of thin air").
984-
pub fn is_coin_base(&self) -> bool {
984+
#[doc(alias = "is_coin_base")] // method previously had this name
985+
pub fn is_coinbase(&self) -> bool {
985986
self.input.len() == 1 && self.input[0].previous_output.is_null()
986987
}
987988

989+
/// Checks if this is a coinbase transaction.
990+
#[deprecated(since = "0.0.0-NEXT-RELEASE", note = "use is_coinbase instead")]
991+
pub fn is_coin_base(&self) -> bool { self.is_coinbase() }
992+
988993
/// Returns `true` if the transaction itself opted in to be BIP-125-replaceable (RBF).
989994
///
990995
/// # Warning
@@ -1578,10 +1583,10 @@ mod tests {
15781583
use crate::network::constants::Network;
15791584

15801585
let genesis = constants::genesis_block(Network::Bitcoin);
1581-
assert!(genesis.txdata[0].is_coin_base());
1586+
assert!(genesis.txdata[0].is_coinbase());
15821587
let tx_bytes = hex!("0100000001a15d57094aa7a21a28cb20b59aab8fc7d1149a3bdbcddba9c622e4f5f6a99ece010000006c493046022100f93bb0e7d8db7bd46e40132d1f8242026e045f03a0efe71bbb8e3f475e970d790221009337cd7f1f929f00cc6ff01f03729b069a7c21b59b1736ddfee5db5946c5da8c0121033b9b137ee87d5a812d6f506efdd37f0affa7ffc310711c06c7f3e097c9447c52ffffffff0100e1f505000000001976a9140389035a9225b3839e2bbf32d826a1e222031fd888ac00000000");
15831588
let tx: Transaction = deserialize(&tx_bytes).unwrap();
1584-
assert!(!tx.is_coin_base());
1589+
assert!(!tx.is_coinbase());
15851590
}
15861591

15871592
#[test]

contrib/release.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ main () {
1212

1313
# Check if there is any mention of NEXT_RELEASE which means the
1414
# next version number should be filled in.
15-
if grep -qr NEXT_RELEASE ./$crate; then
15+
if grep -qr NEXT.RELEASE ./$crate; then
1616
echo Version number needs to be filled in following places:
17-
grep -r NEXT_RELEASE ./$crate
17+
grep -r NEXT.RELEASE ./$crate
1818
exit 1
1919
fi
2020

0 commit comments

Comments
 (0)