Skip to content

Remain functionally compatible with pre-25.0 sendrawtransaction #306

Closed
@ShitcoinsSuck

Description

@ShitcoinsSuck

Recently bitcoin core added an optional parameter to the sendrawtransaction call to limit intentional burns. It was implmented in this commit. This was released in Bitcoin Core 25.0.

Whereas there was no default limit prior to 25.0, the default is now set to 0, meaning sending non-zero values to OP_RETURN via sendrawtransaction will fail by default.

To keep pre-25.0 functionality intact, users of that RPC call (this library among others) will need to send the new maxburnamount parameter in the RPC call, which will also require sending the previously unset maxfeerate.

Changing the send_raw_transaction function body to the following change would accomplish it:

        let server_version=self.version()?;
        if server_version < 250000 {
            self.call("sendrawtransaction", &[tx.raw_hex().into()])
        }
        else {
            // default max rate in bitcoin core is 0.1 COIN
            let default_max_raw_tx_fee_rate : f64 = 0.1;
            // default max burn set to max COIN supply to be compatible with pre-25.0 functionality
            let default_max_burn : i64 = 21000000;
            self.call("sendrawtransaction", &[tx.raw_hex().into(), into_json(default_max_raw_tx_fee_rate)?, into_json(default_max_burn)?])
        }

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