Skip to content

Commit

Permalink
Do some cleanups
Browse files Browse the repository at this point in the history
  • Loading branch information
onchainguy-btc committed Apr 13, 2024
1 parent 627cb65 commit 58c008e
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 86 deletions.
2 changes: 0 additions & 2 deletions src/index/updater/inscription_updater.rs
Original file line number Diff line number Diff line change
Expand Up @@ -409,8 +409,6 @@ impl<'a, 'tx> InscriptionUpdater<'a, 'tx> {
.unwrap()
.value();

println!("is_burned {}", is_burned);

if is_burned {
let entry = InscriptionEntry::load(
self.sequence_number_to_entry
Expand Down
44 changes: 28 additions & 16 deletions src/wallet/batch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ mod tests {
let utxos = vec![(outpoint(1), tx_out(20000, address()))];
let inscription = inscription("text/plain", "ord");
let commit_address = change(0);
let reveal_address = recipient();
let reveal_address = recipient_as_address();
let reveal_change = [commit_address, change(1)];

let batch::Transactions {
Expand Down Expand Up @@ -123,7 +123,7 @@ mod tests {
let utxos = vec![(outpoint(1), tx_out(20000, address()))];
let inscription = inscription("text/plain", "ord");
let commit_address = change(0);
let reveal_address = recipient();
let reveal_address = recipient_as_address();
let reveal_change = [commit_address, change(1)];

let batch::Transactions {
Expand Down Expand Up @@ -173,7 +173,7 @@ mod tests {
let inscription = inscription("text/plain", "ord");
let satpoint = None;
let commit_address = change(0);
let reveal_address = recipient();
let reveal_address = recipient_as_address();

let error = batch::Plan {
satpoint,
Expand Down Expand Up @@ -225,7 +225,7 @@ mod tests {
let inscription = inscription("text/plain", "ord");
let satpoint = None;
let commit_address = change(0);
let reveal_address = recipient();
let reveal_address = recipient_as_address();

assert!(batch::Plan {
satpoint,
Expand Down Expand Up @@ -270,7 +270,7 @@ mod tests {
let inscription = inscription("text/plain", "ord");
let satpoint = None;
let commit_address = change(0);
let reveal_address = recipient();
let reveal_address = recipient_as_address();
let fee_rate = 3.3;

let batch::Transactions {
Expand Down Expand Up @@ -358,7 +358,7 @@ mod tests {
.into();

let commit_address = change(1);
let reveal_address = recipient();
let reveal_address = recipient_as_address();
let fee_rate = 4.0;

let batch::Transactions {
Expand Down Expand Up @@ -444,7 +444,7 @@ mod tests {
let inscription = inscription("text/plain", "ord");
let satpoint = None;
let commit_address = change(0);
let reveal_address = recipient();
let reveal_address = recipient_as_address();
let commit_fee_rate = 3.3;
let fee_rate = 1.0;

Expand Down Expand Up @@ -509,7 +509,7 @@ mod tests {
let inscription = inscription("text/plain", [0; MAX_STANDARD_TX_WEIGHT as usize]);
let satpoint = None;
let commit_address = change(0);
let reveal_address = recipient();
let reveal_address = recipient_as_address();

let error = batch::Plan {
satpoint,
Expand Down Expand Up @@ -550,7 +550,7 @@ mod tests {
let inscription = inscription("text/plain", [0; MAX_STANDARD_TX_WEIGHT as usize]);
let satpoint = None;
let commit_address = change(0);
let reveal_address = recipient();
let reveal_address = recipient_as_address();

let batch::Transactions { reveal_tx, .. } = batch::Plan {
satpoint,
Expand Down Expand Up @@ -605,7 +605,7 @@ mod tests {
wallet_inscriptions.insert(parent_info.location, vec![parent]);

let commit_address = change(1);
let reveal_addresses = vec![recipient()];
let reveal_addresses = vec![recipient_as_address()];

let inscriptions = vec![
InscriptionTemplate {
Expand Down Expand Up @@ -718,7 +718,11 @@ mod tests {
wallet_inscriptions.insert(parent_info.location, vec![parent]);

let commit_address = change(1);
let reveal_addresses = vec![recipient(), recipient(), recipient()];
let reveal_addresses = vec![
recipient_as_address(),
recipient_as_address(),
recipient_as_address()
];

let inscriptions = vec![
InscriptionTemplate {
Expand Down Expand Up @@ -860,7 +864,7 @@ mod tests {
];

let commit_address = change(1);
let reveal_addresses = vec![recipient()];
let reveal_addresses = vec![recipient_as_address()];

let error = batch::Plan {
satpoint: None,
Expand Down Expand Up @@ -937,7 +941,7 @@ mod tests {
];

let commit_address = change(1);
let reveal_addresses = vec![recipient(), recipient()];
let reveal_addresses = vec![recipient_as_address(), recipient_as_address()];

let _ = batch::Plan {
satpoint: None,
Expand Down Expand Up @@ -976,7 +980,7 @@ mod tests {
];

let commit_address = change(1);
let reveal_addresses = vec![recipient()];
let reveal_addresses = vec![recipient_as_address()];

let error = batch::Plan {
satpoint: None,
Expand Down Expand Up @@ -1020,7 +1024,11 @@ mod tests {
let wallet_inscriptions = BTreeMap::new();

let commit_address = change(1);
let reveal_addresses = vec![recipient(), recipient(), recipient()];
let reveal_addresses = vec![
recipient_as_address(),
recipient_as_address(),
recipient_as_address()
];

let inscriptions = vec![
inscription("text/plain", [b'O'; 100]),
Expand Down Expand Up @@ -1089,7 +1097,11 @@ mod tests {
wallet_inscriptions.insert(parent_info.location, vec![parent]);

let commit_address = change(1);
let reveal_addresses = vec![recipient(), recipient(), recipient()];
let reveal_addresses = vec![
recipient_as_address(),
recipient_as_address(),
recipient_as_address()
];

let inscriptions = vec![
InscriptionTemplate {
Expand Down
56 changes: 0 additions & 56 deletions src/wallet/recipient.rs

This file was deleted.

24 changes: 12 additions & 12 deletions tests/wallet/send.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,34 +49,34 @@ fn inscriptions_can_be_sent() {

#[test]
fn inscriptions_can_be_burned() {
let bitcoin_rpc_server = test_bitcoincore_rpc::spawn();
let core = mockcore::spawn();

let ord_rpc_server = TestServer::spawn_with_server_args(&bitcoin_rpc_server, &[], &[]);
let ord = TestServer::spawn_with_server_args(&core, &[], &[]);

create_wallet(&bitcoin_rpc_server, &ord_rpc_server);
create_wallet(&core, &ord);

bitcoin_rpc_server.mine_blocks(1);
core.mine_blocks(1);

let (inscription, _) = inscribe(&bitcoin_rpc_server, &ord_rpc_server);
let (inscription, _) = inscribe(&core, &ord);

bitcoin_rpc_server.mine_blocks(1);
core.mine_blocks(1);

let output = CommandBuilder::new(format!(
"wallet send --fee-rate 1 burn {inscription}",
))
.bitcoin_rpc_server(&bitcoin_rpc_server)
.ord_rpc_server(&ord_rpc_server)
.core(&core)
.ord(&ord)
.stdout_regex(r".*")
.run_and_deserialize_output::<send::Output>();
.run_and_deserialize_output::<Send>();

let txid = bitcoin_rpc_server.mempool()[0].txid();
let txid = core.mempool()[0].txid();
assert_eq!(txid, output.txid);

bitcoin_rpc_server.mine_blocks(1);
core.mine_blocks(1);

let send_txid = output.txid;

ord_rpc_server.assert_response_regex(
ord.assert_response_regex(
format!("/inscription/{inscription}"),
format!(
".*<h1>Inscription 0</h1>.*<dl>.*
Expand Down

0 comments on commit 58c008e

Please sign in to comment.