Skip to content
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ publish = false

[workspace.dependencies.bitcoin-jsonrpsee]
git = "https://github.com/LayerTwo-Labs/bitcoin-jsonrpsee.git"
rev = "4c8edd85722ee65e7598323758b3c032efac37bd"
rev = "5a1d8c84cd6d1a357106e0397ae66cc31e55b855"

[workspace.dependencies.futures]
version = "0.3.30"
Expand Down
13 changes: 9 additions & 4 deletions app/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,13 @@ fn set_tracing_subscriber(log_level: tracing::Level) -> anyhow::Result<()> {
})
}

async fn spawn_rpc_server(
server: server::Server<DefaultEnforcer>,
async fn spawn_rpc_server<RpcClient>(
server: server::Server<DefaultEnforcer, RpcClient>,
serve_rpc_addr: SocketAddr,
) -> anyhow::Result<ServerHandle> {
) -> anyhow::Result<ServerHandle>
where
RpcClient: bitcoin_jsonrpsee::MainClient + Send + Sync + 'static,
{
tracing::info!("serving RPC on {}", serve_rpc_addr);

use server::RpcServer;
Expand Down Expand Up @@ -98,6 +101,7 @@ async fn main() -> anyhow::Result<()> {
};
mempool::init_sync_mempool(
&mut enforcer,
network,
&rpc_client,
&cli.node_zmq_addr_sequence,
shutdown_signal,
Expand All @@ -109,7 +113,7 @@ async fn main() -> anyhow::Result<()> {
enforcer,
mempool,
tx_cache,
rpc_client,
rpc_client.clone(),
sequence_stream,
|err| async {
let err = anyhow::Error::from(err);
Expand All @@ -121,6 +125,7 @@ async fn main() -> anyhow::Result<()> {
mempool,
network,
network_info,
rpc_client,
sample_block_template,
)?;
let rpc_server_handle =
Expand Down
13 changes: 12 additions & 1 deletion lib/cusf_enforcer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ pub enum TxAcceptAction {
/// Transactions that conflict with this one.
/// It is not necessary to specify conflicts due to common inputs.
conflicts_with: HashSet<Txid>,
/// Tweak the weight by the specified value, in wu.
/// The weight will saturate at zero and [`Weight::MAX`].
weight_tweak: i64,
},
Reject,
}
Expand Down Expand Up @@ -476,14 +479,21 @@ where
match self.0.accept_tx(tx, tx_inputs).map_err(Either::Left)? {
TxAcceptAction::Accept {
conflicts_with: left_conflicts,
weight_tweak: left_weight_tweak,
} => {
match self.1.accept_tx(tx, tx_inputs).map_err(Either::Right)? {
TxAcceptAction::Accept {
conflicts_with: right_conflicts,
weight_tweak: right_weight_tweak,
} => {
let mut conflicts_with = left_conflicts;
conflicts_with.extend(right_conflicts);
Ok(TxAcceptAction::Accept { conflicts_with })
let weight_tweak = left_weight_tweak
.saturating_add(right_weight_tweak);
Ok(TxAcceptAction::Accept {
conflicts_with,
weight_tweak,
})
}
TxAcceptAction::Reject => Ok(TxAcceptAction::Reject),
}
Expand Down Expand Up @@ -537,6 +547,7 @@ impl CusfEnforcer for DefaultEnforcer {
{
Ok(TxAcceptAction::Accept {
conflicts_with: HashSet::new(),
weight_tweak: 0,
})
}
}
Expand Down
Loading
Loading