fuels-rs icon indicating copy to clipboard operation
fuels-rs copied to clipboard

Manual block production with Trigger::Never leads to error

Open MujkicA opened this issue 1 year ago • 0 comments

Using Trigger::Never with manual block production leads to the following error:

Error: IOError(Custom { kind: Other, error: "Response errors; unable to produce blocks without a consensus key" })

I've tried setting consensus: ConsensusConfig::default_poa() inside the call to ChainConfig::local_testnet() and verifying the signing key is actually set but the error still persists.

Repro:

async fn test_trig_never() -> Result<()> {
    let config = Config {
        block_production: Trigger::Never,
        ..Config::default()
    };
    let wallets =
        launch_custom_provider_and_get_wallets(WalletsConfig::default(), Some(config), None)
            .await?;
    let wallet = &wallets[0];
    let provider = wallet.try_provider()?;

    let inputs = wallet
        .get_asset_inputs_for_amount(BASE_ASSET_ID, 100)
        .await?;
    let outputs =
        wallet.get_asset_outputs_for_amount(&Bech32Address::default(), BASE_ASSET_ID, 100);

    let mut tb = ScriptTransactionBuilder::prepare_transfer(
        inputs,
        outputs,
        TxPolicies::default(),
    );
    tb.add_signer(wallet.clone());
    let tx = tb.build(&provider).await?;

    provider.send_transaction(tx).await?;
    provider.produce_blocks(1, None).await?;

    Ok(())
}

MujkicA avatar Nov 09 '23 11:11 MujkicA