options, rpc_server, tempdir, index, }) } pub(crate) fn arg(mut self, arg: impl Into) -> Self { self.args.push(arg.into()); self } pub(crate) fn args, I: IntoIterator>(mut self, args: I) -> Self { self.args.extend(args.into_iter().map(|arg| arg.into())); self } pub(crate) fn tempdir(mut self, tempdir: TempDir) -> Self { self.tempdir = Some(tempdir); self } } pub(crate) struct Context { pub(crate) options: Options, pub(crate) rpc_server: test_bitcoincore_rpc::Handle, #[allow(unused)] pub(crate) tempdir: TempDir, pub(crate) index: Index, } impl Context { pub(crate) fn builder() -> ContextBuilder { ContextBuilder { args: Vec::new(), tempdir: None, chain: Chain::Regtest, } } pub(crate) fn mine_blocks(&self, n: u64) -> Vec { let blocks = self.rpc_server.mine_blocks(n); self.index.update().unwrap(); blocks } pub(crate) fn mine_blocks_with_subsidy(&self, n: u64, subsidy: u64) -> Vec {