Skip to content

Commit

Permalink
Update to recent master
Browse files Browse the repository at this point in the history
  • Loading branch information
dr-orlovsky committed Jul 10, 2024
1 parent c021023 commit a83a6b5
Show file tree
Hide file tree
Showing 10 changed files with 24 additions and 39 deletions.
2 changes: 1 addition & 1 deletion bp-core
2 changes: 1 addition & 1 deletion bp-std
2 changes: 1 addition & 1 deletion rgb-core
2 changes: 1 addition & 1 deletion tests/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ services:
depends_on:
- bitcoind
esplora:
image: blockstream/esplora:956c74f42eb6ad803d8aedc272ba83d3aa6dcf5c
image: blockstream/esplora:latest
profiles: [esplora]
command: /srv/explorer/run.sh bitcoin-regtest explorer
environment:
Expand Down
4 changes: 2 additions & 2 deletions tests/utils/chain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ fn _wait_indexer_sync() {
let t_0 = OffsetDateTime::now_utc();
let blockcount = get_height();
loop {
std::thread::sleep(std::time::Duration::from_millis(100));
std::thread::sleep(std::time::Duration::from_millis(500));
match INDEXER.get().unwrap() {
Indexer::Electrum => {
let electrum_client =
Expand All @@ -211,7 +211,7 @@ fn _wait_indexer_sync() {
}
}
}
if (OffsetDateTime::now_utc() - t_0).as_seconds_f32() > 15.0 {
if (OffsetDateTime::now_utc() - t_0).as_seconds_f32() > 25.0 {
panic!("indexer not syncing with bitcoind");
}
}
Expand Down
35 changes: 11 additions & 24 deletions tests/utils/helpers.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
use bpwallet::FsConfig;

Check warning on line 1 in tests/utils/helpers.rs

View workflow job for this annotation

GitHub Actions / format

Diff in /home/runner/work/rgb-integration-tests/rgb-integration-tests/tests/utils/helpers.rs

Check warning on line 1 in tests/utils/helpers.rs

View workflow job for this annotation

GitHub Actions / format

Diff in /home/runner/work/rgb-integration-tests/rgb-integration-tests/tests/utils/helpers.rs
use rgb::RgbWallet;
use super::*;

pub struct Wallet {
stored_wallet: StoredWallet<BpWallet<XpubDerivable, RgbDescr>>,
stored_wallet: RgbWallet<BpWallet<XpubDerivable, RgbDescr>>,
account: MemorySigningAccount,
}

Expand Down Expand Up @@ -344,34 +346,20 @@ pub fn get_wallet(descriptor_type: &DescriptorType) -> Wallet {
std::fs::create_dir_all(&rgb_dir).unwrap();
println!("wallet dir: {rgb_dir:?}");

let mut bp_runtime: BpRuntime<RgbDescr> = BpRuntime::new_standard(descriptor, Network::Regtest);

if bp_runtime.warnings().is_empty() {
eprintln!("success");
} else {
eprintln!("complete with warnings:");
for warning in bp_runtime.warnings() {
eprintln!("- {warning}");
}
bp_runtime.reset_warnings();
}
let mut bp_wallet = BpWallet::new_layer1(descriptor, Network::Regtest);
eprintln!("success");

let name = s!("wallet_name");

Check warning on line 352 in tests/utils/helpers.rs

View workflow job for this annotation

GitHub Actions / format

Diff in /home/runner/work/rgb-integration-tests/rgb-integration-tests/tests/utils/helpers.rs

Check warning on line 352 in tests/utils/helpers.rs

View workflow job for this annotation

GitHub Actions / format

Diff in /home/runner/work/rgb-integration-tests/rgb-integration-tests/tests/utils/helpers.rs
let dir = rgb_dir.join(&name);
bp_runtime.set_name(name);
bp_runtime.store(&dir).unwrap();

let stock = Stock::default();
stock.store(&rgb_dir).unwrap();
let mut stored_stock = StoredStock::attach(rgb_dir.clone(), stock.clone());
bp_wallet.set_name(name);
bp_wallet.set_fs_config(FsConfig { path: dir, autosave: true }).unwrap();

let wallet_path = bp_runtime.path().clone();
let stored_wallet =
StoredWallet::attach(rgb_dir.clone(), wallet_path, stock, bp_runtime.detach());
let stock = Stock::new(rgb_dir);
let mut stored_wallet = RgbWallet::new(stock, bp_wallet);

for asset_schema in AssetSchema::iter() {
let valid_kit = asset_schema.get_valid_kit();
stored_stock.import_kit(valid_kit).unwrap();
stored_wallet.stock_mut().import_kit(valid_kit).unwrap();
}

let mut wallet = Wallet {
Expand Down Expand Up @@ -490,7 +478,6 @@ impl Wallet {
.update(&indexer)
.into_result()
.unwrap();
self.stored_wallet.store();
}

pub fn close_method(&self) -> CloseMethod {
Expand Down Expand Up @@ -693,7 +680,7 @@ impl Wallet {
if attempts > 3 {
panic!("error accepting transfer: {e}");
}
std::thread::sleep(std::time::Duration::from_millis(100));
std::thread::sleep(std::time::Duration::from_millis(500));
}
}

Expand Down
10 changes: 4 additions & 6 deletions tests/utils/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ pub use bpstd::{
DerivationPath as BpDerivationPath, DerivationSeg, HardenedIndex, Keychain, Network, Xpub,
XpubDerivable, XpubFp, XpubOrigin,
};
pub use bpwallet::{AnyIndexer, Runtime as BpRuntime, Wallet as BpWallet};
pub use bpwallet::{AnyIndexer, Wallet as BpWallet};
pub use descriptors::Wpkh;
pub use dw_psbt::{
serialize::Deserialize,
Expand All @@ -58,19 +58,17 @@ pub use once_cell::sync::Lazy;
pub use psbt::PsbtVer;

Check warning on line 58 in tests/utils/mod.rs

View workflow job for this annotation

GitHub Actions / format

Diff in /home/runner/work/rgb-integration-tests/rgb-integration-tests/tests/utils/mod.rs

Check warning on line 58 in tests/utils/mod.rs

View workflow job for this annotation

GitHub Actions / format

Diff in /home/runner/work/rgb-integration-tests/rgb-integration-tests/tests/utils/mod.rs
pub use rand::RngCore;
pub use rgb::{
invoice::Pay2Vout, stl::ContractTerms, AnyResolver, DescriptorRgb, GenesisSeal, GraphSeal,
Identity, RgbDescr, RgbKeychain, StoredStock, StoredWallet, TapretKey, TransferParams,
invoice::Pay2Vout, stl::ContractTerms, DescriptorRgb, GenesisSeal, GraphSeal,
Identity, RgbDescr, RgbKeychain, TapretKey, TransferParams,
WalletProvider,
};
pub use rgbstd::{
resolvers::AnyResolver,
containers::{BuilderSeal, FileContent, Kit, Transfer, ValidKit},
interface::{
ContractBuilder, ContractIface, DataAllocation, FilterExclude, FungibleAllocation, Iface,
IfaceClass, IfaceId, IfaceImpl, NamedField,

Check warning on line 68 in tests/utils/mod.rs

View workflow job for this annotation

GitHub Actions / format

Diff in /home/runner/work/rgb-integration-tests/rgb-integration-tests/tests/utils/mod.rs

Check warning on line 68 in tests/utils/mod.rs

View workflow job for this annotation

GitHub Actions / format

Diff in /home/runner/work/rgb-integration-tests/rgb-integration-tests/tests/utils/mod.rs
},
invoice::{Beneficiary, RgbInvoice, RgbInvoiceBuilder, XChainNet},
persistence::{
fs::{LoadFs, StoreFs},
PersistedState, SchemaIfaces, StashReadProvider, Stock,
},
schema::SchemaId,
Expand Down

0 comments on commit a83a6b5

Please sign in to comment.