Skip to content

Commit

Permalink
Avoid push_scriptint (ordinals#1136)
Browse files Browse the repository at this point in the history
  • Loading branch information
casey committed Jan 2, 2023
1 parent a2394a5 commit 274b7de
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 18 deletions.
2 changes: 1 addition & 1 deletion src/index.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1053,7 +1053,7 @@ mod tests {
assert_eq!(
context.index.find(50 * COIN_VALUE).unwrap().unwrap(),
SatPoint {
outpoint: "0c4eb1fa83a7d6ce0e21e5e616a96e83a7b1658170fb544acf6f5c6a2d4b3f90:0"
outpoint: "30f2f037629c6a21c1f40ed39b9bd6278df39762d68d07f49582b23bcb23386a:0"
.parse()
.unwrap(),
offset: 0,
Expand Down
8 changes: 4 additions & 4 deletions src/subcommand/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1399,8 +1399,8 @@ mod tests {
<dt>hash</dt><dd class=monospace>[[:xdigit:]]{64}</dd>
<dt>target</dt><dd class=monospace>[[:xdigit:]]{64}</dd>
<dt>timestamp</dt><dd>0</dd>
<dt>size</dt><dd>203</dd>
<dt>weight</dt><dd>812</dd>
<dt>size</dt><dd>202</dd>
<dt>weight</dt><dd>808</dd>
<dt>previous blockhash</dt><dd><a href=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/block/659f9b67fbc0b5cba0ef6ebc0aea322e1c246e29e43210bd581f5f3bd36d17bf class=monospace>659f9b67fbc0b5cba0ef6ebc0aea322e1c246e29e43210bd581f5f3bd36d17bf</a></dd>
</dl>
<a href=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/block/1>prev</a>
Expand Down Expand Up @@ -1448,8 +1448,8 @@ next.*",
<h2>1 Output</h2>
<ul class=monospace>
<li>
<a href=/output/0c4eb1fa83a7d6ce0e21e5e616a96e83a7b1658170fb544acf6f5c6a2d4b3f90:0 class=monospace>
0c4eb1fa83a7d6ce0e21e5e616a96e83a7b1658170fb544acf6f5c6a2d4b3f90:0
<a href=/output/30f2f037629c6a21c1f40ed39b9bd6278df39762d68d07f49582b23bcb23386a:0 class=monospace>
30f2f037629c6a21c1f40ed39b9bd6278df39762d68d07f49582b23bcb23386a:0
</a>
<dl>
<dt>value</dt><dd>5000000000</dd>
Expand Down
6 changes: 3 additions & 3 deletions src/templates/input.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ mod tests {
previous_output: "0000000000000000000000000000000000000000000000000000000000000000:0"
.parse()
.unwrap(),
script_sig: script::Builder::new().push_scriptint(4).into_script(),
script_sig: script::Builder::new().push_slice("foo".as_bytes()).into_script(),
sequence: Sequence::MAX,
witness,
}
Expand All @@ -41,8 +41,8 @@ mod tests {
<dl>
<dt>previous output</dt><dd class=monospace>0000000000000000000000000000000000000000000000000000000000000000:0</dd>
<dt>witness</dt><dd class=data>010101</dd>
<dt>script sig</dt><dd class=data>OP_PUSHBYTES_1 04</dd>
<dt>text</dt><dd>\x01\x04</dd>
<dt>script sig</dt><dd class=data>OP_PUSHBYTES_3 666f6f</dd>
<dt>text</dt><dd>\x03foo</dd>
</dl>
"
.unindent()
Expand Down
2 changes: 1 addition & 1 deletion src/templates/output.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ mod tests {
chain: Chain::Mainnet,
output: TxOut {
value: 1,
script_pubkey: script::Builder::new().push_scriptint(0).into_script(),
script_pubkey: script::Builder::new().push_int(0).into_script(),
},
}
.to_string(),
Expand Down
16 changes: 8 additions & 8 deletions src/templates/transaction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,37 +45,37 @@ mod tests {
output: vec![
TxOut {
value: 50 * COIN_VALUE,
script_pubkey: script::Builder::new().push_scriptint(0).into_script(),
script_pubkey: script::Builder::new().push_int(0).into_script(),
},
TxOut {
value: 50 * COIN_VALUE,
script_pubkey: script::Builder::new().push_scriptint(1).into_script(),
script_pubkey: script::Builder::new().push_int(1).into_script(),
},
],
};

pretty_assert_eq!(
TransactionHtml::new(transaction, None, Chain::Mainnet).to_string(),
"
<h1>Transaction <span class=monospace>9108ec7cbe9f1231dbf6374251b7267fb31cb23f36ed5a1d7344f5635b17dfe9</span></h1>
<h1>Transaction <span class=monospace>9c03542773bfbbf2a951a54e73e2955eeb0e070df07e753e1055de1ea54a74bb</span></h1>
<h2>2 Outputs</h2>
<ul class=monospace>
<li>
<a href=/output/9108ec7cbe9f1231dbf6374251b7267fb31cb23f36ed5a1d7344f5635b17dfe9:0 class=monospace>
9108ec7cbe9f1231dbf6374251b7267fb31cb23f36ed5a1d7344f5635b17dfe9:0
<a href=/output/9c03542773bfbbf2a951a54e73e2955eeb0e070df07e753e1055de1ea54a74bb:0 class=monospace>
9c03542773bfbbf2a951a54e73e2955eeb0e070df07e753e1055de1ea54a74bb:0
</a>
<dl>
<dt>value</dt><dd>5000000000</dd>
<dt>script pubkey</dt><dd class=data>OP_0</dd>
</dl>
</li>
<li>
<a href=/output/9108ec7cbe9f1231dbf6374251b7267fb31cb23f36ed5a1d7344f5635b17dfe9:1 class=monospace>
9108ec7cbe9f1231dbf6374251b7267fb31cb23f36ed5a1d7344f5635b17dfe9:1
<a href=/output/9c03542773bfbbf2a951a54e73e2955eeb0e070df07e753e1055de1ea54a74bb:1 class=monospace>
9c03542773bfbbf2a951a54e73e2955eeb0e070df07e753e1055de1ea54a74bb:1
</a>
<dl>
<dt>value</dt><dd>5000000000</dd>
<dt>script pubkey</dt><dd class=data>OP_PUSHBYTES_1 01</dd>
<dt>script pubkey</dt><dd class=data>OP_PUSHNUM_1</dd>
</dl>
</li>
</ul>
Expand Down
2 changes: 1 addition & 1 deletion test-bitcoincore-rpc/src/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ impl State {
input: vec![TxIn {
previous_output: OutPoint::null(),
script_sig: script::Builder::new()
.push_scriptint(self.blocks.len().try_into().unwrap())
.push_int(self.blocks.len().try_into().unwrap())
.into_script(),
sequence: Sequence::MAX,
witness: Witness::new(),
Expand Down

0 comments on commit 274b7de

Please sign in to comment.