Skip to content

Commit

Permalink
Use transaction version 2 (#2873)
Browse files Browse the repository at this point in the history
  • Loading branch information
casey authored Dec 18, 2023
1 parent 1fd865d commit bdc06cc
Show file tree
Hide file tree
Showing 14 changed files with 51 additions and 51 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
2 changes: 1 addition & 1 deletion src/index.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2245,7 +2245,7 @@ mod tests {
assert_eq!(
context.index.find(Sat(50 * COIN_VALUE)).unwrap().unwrap(),
SatPoint {
outpoint: "30f2f037629c6a21c1f40ed39b9bd6278df39762d68d07f49582b23bcb23386a:0"
outpoint: "84aca0d43f45ac753d4744f40b2f54edec3a496b298951735d450e601386089d:0"
.parse()
.unwrap(),
offset: 0,
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
4 changes: 2 additions & 2 deletions src/subcommand/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3130,8 +3130,8 @@ mod tests {
<h2>1 Output</h2>
<ul class=monospace>
<li>
<a href=/output/30f2f037629c6a21c1f40ed39b9bd6278df39762d68d07f49582b23bcb23386a:0 class=monospace>
30f2f037629c6a21c1f40ed39b9bd6278df39762d68d07f49582b23bcb23386a:0
<a href=/output/84aca0d43f45ac753d4744f40b2f54edec3a496b298951735d450e601386089d:0 class=monospace>
84aca0d43f45ac753d4744f40b2f54edec3a496b298951735d450e601386089d:0
</a>
<dl>
<dt>value</dt><dd>5000000000</dd>
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
Loading

0 comments on commit bdc06cc

Please sign in to comment.