Skip to content

Commit

Permalink
Merge pull request #222 from apoelstra/2025-02--elements-22+
Browse files Browse the repository at this point in the history
elementsd-tests: blind asset issuance based on node version
  • Loading branch information
delta1 authored Feb 20, 2025
2 parents 03426a6 + 4f29295 commit 73403be
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions elementsd-tests/src/pset.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ fn tx_blinded() {
fn tx_issuance() {
let (elementsd, _bitcoind) = setup(false);

// Divide out minor and patch version
let is_21 = elementsd.client().version().expect("obtain version") / 10000 == 21;

let address_asset = elementsd.get_new_address();
let address_reissuance = elementsd.get_new_address();
let address_lbtc = elementsd.get_new_address();
Expand All @@ -55,12 +58,12 @@ fn tx_issuance() {
let contract_hash = ContractHash::from_byte_array([0u8; 32]);
let entropy = AssetId::generate_asset_entropy(prevout, contract_hash);
let asset_id = AssetId::from_entropy(entropy.clone());
let reissuance_id = AssetId::reissuance_token_from_entropy(entropy, true);
let reissuance_id = AssetId::reissuance_token_from_entropy(entropy, is_21);

let value = elementsd.call(
"createpsbt",
&[
json!([{ "txid": prevout.txid.to_string(), "vout": prevout.vout, "issuance_amount": 1000, "issuance_tokens": 1}]),
json!([{ "txid": prevout.txid.to_string(), "vout": prevout.vout, "issuance_amount": 1000, "issuance_tokens": 1, "blind_reissuance": is_21}]),
json!([
{address_asset: "1000", "asset": asset_id.to_string(), "blinder_index": 0},
{address_reissuance: "1", "asset": reissuance_id.to_string(), "blinder_index": 0},
Expand Down

0 comments on commit 73403be

Please sign in to comment.