Skip to content

Commit beeb4da

Browse files
committed
feat(engine): Add LeftoversStore trait to store any amounts pending to be settled
1 parent 2cf72b4 commit beeb4da

File tree

2 files changed

+18
-0
lines changed
  • crates/interledger-settlement-engines/src/stores

2 files changed

+18
-0
lines changed

crates/interledger-settlement-engines/src/stores/mod.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
use bytes::Bytes;
22
use futures::future::Future;
33
use http::StatusCode;
4+
use num_bigint::BigUint;
45

56
pub mod redis_ethereum_ledger;
67
pub mod redis_store_common;
@@ -28,3 +29,12 @@ pub trait IdempotentEngineStore {
2829
data: Bytes,
2930
) -> Box<dyn Future<Item = (), Error = ()> + Send>;
3031
}
32+
33+
pub trait LeftoversStore {
34+
/// Saves the leftover data
35+
fn save_leftovers(
36+
&self,
37+
account_id: String,
38+
leftovers: BigUint,
39+
) -> Box<dyn Future<Item = (), Error = ()> + Send>;
40+
}

crates/interledger-settlement-engines/src/stores/redis_ethereum_ledger/store.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ use redis::{self, cmd, r#async::SharedConnection, ConnectionInfo, PipelineComman
1313
use log::{error, trace};
1414

1515
use crate::stores::redis_store_common::{EngineRedisStore, EngineRedisStoreBuilder};
16+
use crate::stores::LeftoversStore;
17+
use num_bigint::BigUint;
1618

1719
// Key for the latest observed block and balance. The data is stored in order to
1820
// avoid double crediting transactions which have already been processed, and in
@@ -105,6 +107,12 @@ impl EthereumLedgerRedisStore {
105107
}
106108
}
107109

110+
impl LeftoversStore for EthereumLedgerRedisStore {
111+
fn save_leftovers(&self, account_id: String, leftovers: BigUint) -> Box<dyn Future<Item = (), Error = ()> + Send> {
112+
Box::new(ok(()))
113+
}
114+
}
115+
108116
impl EthereumStore for EthereumLedgerRedisStore {
109117
type Account = Account;
110118

0 commit comments

Comments
 (0)