Skip to content

Commit

Permalink
Use transaction version 2
Browse files Browse the repository at this point in the history
  • Loading branch information
casey committed Dec 17, 2023
1 parent 0434ff3 commit 64adb13
Show file tree
Hide file tree
Showing 11 changed files with 47 additions and 47 deletions.
2 changes: 1 addition & 1 deletion fuzz/fuzz_targets/runestone_decipher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ fuzz_target!(|input: Vec<Vec<u8>>| {
script_pubkey: builder.into_script(),
value: 0,
}],
version: 0,
version: 2,
};

Runestone::from_transaction(&tx);
Expand Down
2 changes: 1 addition & 1 deletion src/envelope.rs
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ mod tests {

fn parse(witnesses: &[Witness]) -> Vec<ParsedEnvelope> {
ParsedEnvelope::from_transaction(&Transaction {
version: 0,
version: 2,
lock_time: LockTime::ZERO,
input: witnesses
.iter()
Expand Down
32 changes: 16 additions & 16 deletions src/runes/runestone.rs
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ mod tests {
value: 0,
}],
lock_time: LockTime::ZERO,
version: 0,
version: 2,
})
.unwrap()
.unwrap()
Expand All @@ -273,7 +273,7 @@ mod tests {
value: 0,
}],
lock_time: LockTime::ZERO,
version: 0,
version: 2,
}),
None
);
Expand All @@ -286,7 +286,7 @@ mod tests {
input: Vec::new(),
output: Vec::new(),
lock_time: LockTime::ZERO,
version: 0,
version: 2,
}),
Ok(None)
);
Expand All @@ -302,7 +302,7 @@ mod tests {
value: 0
}],
lock_time: LockTime::ZERO,
version: 0,
version: 2,
}),
Ok(None)
);
Expand All @@ -320,7 +320,7 @@ mod tests {
value: 0
}],
lock_time: LockTime::ZERO,
version: 0,
version: 2,
}),
Ok(None)
);
Expand All @@ -339,7 +339,7 @@ mod tests {
value: 0
}],
lock_time: LockTime::ZERO,
version: 0,
version: 2,
}),
Ok(None)
);
Expand All @@ -354,7 +354,7 @@ mod tests {
value: 0,
}],
lock_time: LockTime::ZERO,
version: 0,
version: 2,
})
.unwrap_err();
}
Expand All @@ -376,7 +376,7 @@ mod tests {
value: 0,
}],
lock_time: LockTime::ZERO,
version: 0,
version: 2,
})
.unwrap_err();
}
Expand All @@ -394,7 +394,7 @@ mod tests {
value: 0,
}],
lock_time: LockTime::ZERO,
version: 0,
version: 2,
})
.unwrap();
}
Expand All @@ -415,7 +415,7 @@ mod tests {
value: 0,
}],
lock_time: LockTime::ZERO,
version: 0,
version: 2,
})
.unwrap()
.unwrap(),
Expand Down Expand Up @@ -443,7 +443,7 @@ mod tests {
value: 0
}],
lock_time: LockTime::ZERO,
version: 0,
version: 2,
}),
Ok(Some(Runestone::default()))
);
Expand Down Expand Up @@ -478,7 +478,7 @@ mod tests {
},
],
lock_time: LockTime::ZERO,
version: 0,
version: 2,
})
.unwrap_err();
}
Expand Down Expand Up @@ -986,7 +986,7 @@ mod tests {
value: 0
}],
lock_time: LockTime::ZERO,
version: 0,
version: 2,
}),
Ok(Some(Runestone {
edicts: vec![Edict {
Expand Down Expand Up @@ -1027,7 +1027,7 @@ mod tests {
}
],
lock_time: LockTime::ZERO,
version: 0,
version: 2,
}),
Ok(Some(Runestone {
edicts: vec![Edict {
Expand Down Expand Up @@ -1067,7 +1067,7 @@ mod tests {
}
],
lock_time: LockTime::ZERO,
version: 0,
version: 2,
}),
Ok(Some(Runestone {
edicts: vec![Edict {
Expand Down Expand Up @@ -1372,7 +1372,7 @@ mod tests {
value: 0,
}],
lock_time: LockTime::ZERO,
version: 0,
version: 2,
};

let payload = Runestone::payload(&transaction).unwrap().unwrap();
Expand Down
2 changes: 1 addition & 1 deletion src/subcommand/wallet/etch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ impl Etch {
);

let unfunded_transaction = Transaction {
version: 1,
version: 2,
lock_time: LockTime::ZERO,
input: Vec::new(),
output: vec![
Expand Down
2 changes: 1 addition & 1 deletion src/subcommand/wallet/inscribe/batch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -492,7 +492,7 @@ impl Batch {
.collect(),
output: outputs,
lock_time: LockTime::ZERO,
version: 1,
version: 2,
};

let fee = {
Expand Down
2 changes: 1 addition & 1 deletion src/subcommand/wallet/send.rs
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ impl Send {
};

let unfunded_transaction = Transaction {
version: 1,
version: 2,
lock_time: LockTime::ZERO,
input: input
.into_iter()
Expand Down
36 changes: 18 additions & 18 deletions src/subcommand/wallet/transaction_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,7 @@ impl TransactionBuilder {

fn estimate_vbytes_with(inputs: usize, outputs: Vec<Address>) -> usize {
Transaction {
version: 1,
version: 2,
lock_time: LockTime::ZERO,
input: (0..inputs)
.map(|_| TxIn {
Expand Down Expand Up @@ -456,7 +456,7 @@ impl TransactionBuilder {
fn build(self) -> Result<Transaction> {
let recipient = self.recipient.script_pubkey();
let transaction = Transaction {
version: 1,
version: 2,
lock_time: LockTime::ZERO,
input: self
.inputs
Expand Down Expand Up @@ -787,7 +787,7 @@ mod tests {
pretty_assert_eq!(
tx_builder.build(),
Ok(Transaction {
version: 1,
version: 2,
lock_time: LockTime::ZERO,
input: vec![tx_in(outpoint(1)), tx_in(outpoint(2)), tx_in(outpoint(3))],
output: vec![
Expand Down Expand Up @@ -837,7 +837,7 @@ mod tests {
)
.build_transaction(),
Ok(Transaction {
version: 1,
version: 2,
lock_time: LockTime::ZERO,
input: vec![tx_in(outpoint(1))],
output: vec![tx_out(4901, recipient())],
Expand Down Expand Up @@ -889,7 +889,7 @@ mod tests {
)
.build_transaction(),
Ok(Transaction {
version: 1,
version: 2,
lock_time: LockTime::ZERO,
input: vec![tx_in(outpoint(1)), tx_in(outpoint(2))],
output: vec![tx_out(4_950, change(1)), tx_out(4_862, recipient())],
Expand Down Expand Up @@ -963,7 +963,7 @@ mod tests {
)
.build_transaction(),
Ok(Transaction {
version: 1,
version: 2,
lock_time: LockTime::ZERO,
input: vec![tx_in(outpoint(1)), tx_in(outpoint(2))],
output: vec![
Expand Down Expand Up @@ -1104,7 +1104,7 @@ mod tests {
)
.build_transaction(),
Ok(Transaction {
version: 1,
version: 2,
lock_time: LockTime::ZERO,
input: vec![tx_in(outpoint(1))],
output: vec![
Expand Down Expand Up @@ -1155,7 +1155,7 @@ mod tests {
)
.build_transaction(),
Ok(Transaction {
version: 1,
version: 2,
lock_time: LockTime::ZERO,
input: vec![tx_in(outpoint(1))],
output: vec![tx_out(3_333, change(1)), tx_out(6_537, recipient())],
Expand Down Expand Up @@ -1184,7 +1184,7 @@ mod tests {
)
.build_transaction(),
Ok(Transaction {
version: 1,
version: 2,
lock_time: LockTime::ZERO,
input: vec![tx_in(outpoint(2)), tx_in(outpoint(1))],
output: vec![tx_out(10_001, change(1)), tx_out(9_811, recipient())],
Expand Down Expand Up @@ -1456,7 +1456,7 @@ mod tests {
pretty_assert_eq!(
transaction,
Transaction {
version: 1,
version: 2,
lock_time: LockTime::ZERO,
input: vec![tx_in(outpoint(1))],
output: vec![tx_out(10_000 - fee.to_sat(), recipient())],
Expand All @@ -1482,7 +1482,7 @@ mod tests {
)
.build_transaction(),
Ok(Transaction {
version: 1,
version: 2,
lock_time: LockTime::ZERO,
input: vec![tx_in(outpoint(1))],
output: vec![tx_out(1000, recipient()), tx_out(3870, change(1))],
Expand Down Expand Up @@ -1511,7 +1511,7 @@ mod tests {
)
.build_transaction(),
Ok(Transaction {
version: 1,
version: 2,
lock_time: LockTime::ZERO,
input: vec![tx_in(outpoint(1)), tx_in(outpoint(2))],
output: vec![tx_out(1500, recipient()), tx_out(312, change(1))],
Expand Down Expand Up @@ -1631,7 +1631,7 @@ mod tests {
)
.build_transaction(),
Ok(Transaction {
version: 1,
version: 2,
lock_time: LockTime::ZERO,
input: vec![tx_in(outpoint(1))],
output: vec![tx_out(901, recipient())],
Expand All @@ -1657,7 +1657,7 @@ mod tests {
)
.build_transaction(),
Ok(Transaction {
version: 1,
version: 2,
lock_time: LockTime::ZERO,
input: vec![tx_in(outpoint(1))],
output: vec![tx_out(20_000, recipient())],
Expand All @@ -1683,7 +1683,7 @@ mod tests {
)
.build_transaction(),
Ok(Transaction {
version: 1,
version: 2,
lock_time: LockTime::ZERO,
input: vec![tx_in(outpoint(1))],
output: vec![tx_out(1005, recipient())],
Expand Down Expand Up @@ -1772,7 +1772,7 @@ mod tests {
)
.build_transaction(),
Ok(Transaction {
version: 1,
version: 2,
lock_time: LockTime::ZERO,
input: vec![tx_in(outpoint(1))],
output: vec![tx_out(1802, recipient())],
Expand All @@ -1798,7 +1798,7 @@ mod tests {
)
.build_transaction(),
Ok(Transaction {
version: 1,
version: 2,
lock_time: LockTime::ZERO,
input: vec![tx_in(outpoint(1))],
output: vec![tx_out(20250, recipient())],
Expand Down Expand Up @@ -1992,7 +1992,7 @@ mod tests {
pretty_assert_eq!(
transaction,
Transaction {
version: 1,
version: 2,
lock_time: LockTime::ZERO,
input: vec![tx_in(outpoint(1))],
output: vec![
Expand Down
4 changes: 2 additions & 2 deletions src/templates/transaction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ mod tests {
#[test]
fn html() {
let transaction = Transaction {
version: 0,
version: 2,
lock_time: LockTime::ZERO,
input: vec![TxIn {
sequence: Default::default(),
Expand Down Expand Up @@ -105,7 +105,7 @@ mod tests {
#[test]
fn with_blockhash() {
let transaction = Transaction {
version: 0,
version: 2,
lock_time: LockTime::ZERO,
input: Vec::new(),
output: vec![
Expand Down
6 changes: 3 additions & 3 deletions test-bitcoincore-rpc/src/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ impl Api for Server {
assert_eq!(replaceable, None, "replaceable param not supported");

let tx = Transaction {
version: 0,
version: 2,
lock_time: LockTime::ZERO,
input: utxos
.iter()
Expand Down Expand Up @@ -403,7 +403,7 @@ impl Api for Server {
};

let mut transaction = Transaction {
version: 1,
version: 2,
lock_time: LockTime::ZERO,
input: vec![TxIn {
previous_output: *outpoint,
Expand Down Expand Up @@ -492,7 +492,7 @@ impl Api for Server {
hash: Wtxid::all_zeros(),
size: 0,
vsize: 0,
version: 0,
version: 2,
locktime: 0,
vin: Vec::new(),
vout: Vec::new(),
Expand Down
Loading

0 comments on commit 64adb13

Please sign in to comment.