Skip to content

Commit 22df3bf

Browse files
feat: submit chain lock (#40)
1 parent 016e3af commit 22df3bf

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

client/src/client.rs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@ use dashcore::{
2828
Address, Amount, Block, OutPoint, PrivateKey, ProTxHash, PublicKey, QuorumHash, Transaction,
2929
};
3030
use dashcore_private::hex::display::DisplayHex;
31-
use dashcore_rpc_json::dashcore::BlockHash;
31+
use hex::ToHex;
32+
use dashcore_rpc_json::dashcore::{BlockHash, ChainLock};
3233
use dashcore_rpc_json::{ProTxInfo, ProTxListType, QuorumType};
3334
use log::Level::{Debug, Trace, Warn};
3435

@@ -1528,6 +1529,16 @@ pub trait RpcApi: Sized {
15281529
self.call::<bool>("verifychainlock", handle_defaults(&mut args, &[null()]))
15291530
}
15301531

1532+
/// Submits a chain lock if needed
1533+
fn submit_chainlock(
1534+
&self,
1535+
chain_lock: ChainLock,
1536+
) -> Result<bool> {
1537+
let mut args =
1538+
[into_json(hex::encode(chain_lock.block_hash))?, into_json(hex::encode(chain_lock.signature))?, into_json(chain_lock.block_height)?];
1539+
self.call::<bool>("submitchainlock", handle_defaults(&mut args, &[null()]))
1540+
}
1541+
15311542
/// Tests if a quorum signature is valid for an InstantSend Lock
15321543
fn get_verifyislock(
15331544
&self,

0 commit comments

Comments
 (0)