Skip to content

elementsd-tests: blind asset issuance based on node version #222

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 20, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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