Skip to content
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
14 changes: 12 additions & 2 deletions src/bitcoin.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
use std::{
collections::HashSet,
collections::{HashMap, HashSet},
fs::File,
future::Future,
process::Stdio,
sync::Arc,
time::{Duration, Instant},
};

use anyhow::{bail, Context};
use anyhow::{anyhow, bail, Context};
use async_trait::async_trait;
use bitcoin::Address;
use bitcoincore_rpc::{json::AddressType::Bech32m, Auth, Client, RpcApi};
Expand Down Expand Up @@ -165,6 +165,16 @@ impl BitcoinNode {
) -> bitcoincore_rpc::Result<Vec<bitcoin::BlockHash>> {
RpcApi::generate(self, block_num, None).await
}

pub async fn generate_block(
&self,
// Address to send the block reward to
output: String,
// Either raw txs or txids, should be in mempool and in correct order
transactions: Vec<String>,
) -> bitcoincore_rpc::Result<HashMap<String, String>> {
RpcApi::call(self, "generateblock", &[output.into(), transactions.into()]).await
}
}

#[async_trait]
Expand Down
Loading