Skip to content

retrying to implement exact expiry #47

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
152 changes: 145 additions & 7 deletions Cargo.lock

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

3 changes: 2 additions & 1 deletion migration/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,6 @@ sea-orm-migration = { version = "=0.12.14", default-features = false, features =
"sqlx-mysql",
"sqlx-postgres",
"sqlx-sqlite",
"runtime-async-std-native-tls"
"runtime-async-std-native-tls",
"cli",
] }
2 changes: 2 additions & 0 deletions migration/src/m20230608_071249_init_db.rs
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ impl MigrationTrait for Migration {
.not_null(),
)
.col(ColumnDef::new(BatchTransfer::Expiration).big_unsigned())
.col(ColumnDef::new(BatchTransfer::ExactExpiry).boolean())
.col(
ColumnDef::new(BatchTransfer::MinConfirmations)
.tiny_unsigned()
Expand Down Expand Up @@ -646,6 +647,7 @@ pub enum BatchTransfer {
CreatedAt,
UpdatedAt,
Expiration,
ExactExpiry,
MinConfirmations,
}

Expand Down
3 changes: 3 additions & 0 deletions src/database/entities/batch_transfer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ pub struct Model {
pub created_at: i64,
pub updated_at: i64,
pub expiration: Option<i64>,
pub exact_expiry: Option<bool>,
pub min_confirmations: u8,
}

Expand All @@ -32,6 +33,7 @@ pub enum Column {
CreatedAt,
UpdatedAt,
Expiration,
ExactExpiry,
MinConfirmations,
}

Expand Down Expand Up @@ -62,6 +64,7 @@ impl ColumnTrait for Column {
Self::CreatedAt => ColumnType::BigInteger.def(),
Self::UpdatedAt => ColumnType::BigInteger.def(),
Self::Expiration => ColumnType::BigInteger.def().null(),
Self::ExactExpiry => ColumnType::Boolean.def().null(),
Self::MinConfirmations => ColumnType::SmallInteger.def(),
}
}
Expand Down
2 changes: 2 additions & 0 deletions src/database/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,7 @@ pub(crate) struct TransferData {
pub(crate) created_at: i64,
pub(crate) updated_at: i64,
pub(crate) expiration: Option<i64>,
pub(crate) exact_expiry: Option<bool>,
}

pub struct RgbLibDatabase {
Expand Down Expand Up @@ -936,6 +937,7 @@ impl RgbLibDatabase {
created_at: batch_transfer.created_at,
updated_at: batch_transfer.updated_at,
expiration: batch_transfer.expiration,
exact_expiry: batch_transfer.exact_expiry,
})
}

Expand Down
4 changes: 2 additions & 2 deletions src/wallet/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1093,7 +1093,7 @@ pub struct Transfer {
/// Change UTXO of an outgoing transfer
pub change_utxo: Option<Outpoint>,
/// Expiration of the transfer
pub expiration: Option<i64>,
pub expiration: Option<(i64, bool)>,
/// Transport endpoints for the transfer
pub transport_endpoints: Vec<TransferTransportEndpoint>,
}
Expand All @@ -1119,7 +1119,7 @@ impl Transfer {
recipient_id: x.recipient_id.clone(),
receive_utxo: td.receive_utxo,
change_utxo: td.change_utxo,
expiration: td.expiration,
expiration: td.expiration.map(|e| (e, td.exact_expiry.unwrap())),
transport_endpoints,
}
}
Expand Down