Skip to content

[V0.12] Support for mainnet wallet initialization in RGB v0.12 #289

@will-bitlightlabs

Description

@will-bitlightlabs

Description

While implementing tests for RGB v0.12, I noticed that the current implementation doesn't support initialization of mainnet wallets.

The current API appears to only provide testnet-related functionality. I understand this might be intentional as part of a phased development approach, focusing on testnet stability before adding mainnet support.

Current Limitation

In the Mound structure, there's currently no public API to initialize a mainnet wallet. The only available constructors are:

  • bitcoin_testnet()
  • with_testnet(consensus, persistence)
  • open_testnet(consensus, persistence)

All of these methods set testnet: true by default, with no option to set it to false for mainnet.

Impact

This limitation affects our ability to test scenarios where assets need to be transferred between testnet and mainnet wallets. For example, in our test case mainnet_wlt_receiving_test_asset, we're trying to test sending assets from a testnet wallet to a mainnet wallet:

#[test]
#[ignore = "fix needed"]
fn mainnet_wlt_receiving_test_asset() {
    initialize();

    let mut wlt_1 = get_wallet(&DescriptorType::Wpkh);
    // FIXME: Because the latest `Mound` structure in rgb does not support setting the mainnet,
    // The default `Mound.testnet` is eq true, which cannot correctly initialize the mainnet wallet,
    // So this test case cannot be executed temporarily
    let mut wlt_2 = get_mainnet_wallet();
    
    // Test implementation...
}

Proposed Solution

We could submit a PR to add the necessary API for initializing mainnet wallets, which would enable us to properly test these scenarios. However, we'd like to know whether it's better to submit these PRs now or wait until the overall API becomes more stable?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions