Skip to content

Commit 19f2786

Browse files
authored
Merge pull request zingolabs#1466 from AloeareV/fix_disappearing_sendtotex
save sent mempool transactions to disk
2 parents c6d3c7d + d8c3860 commit 19f2786

File tree

9 files changed

+154
-156
lines changed

9 files changed

+154
-156
lines changed

darkside-tests/tests/advanced_reorg_tests.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1048,7 +1048,7 @@ async fn reorg_changes_outgoing_tx_index() {
10481048
//
10491049

10501050
// stage empty blocks from height 205 to cause a Reorg
1051-
_ = connector.stage_blocks_create(sent_tx_height, 20, 1).await;
1051+
_ = connector.stage_blocks_create(sent_tx_height, 20, 102).await;
10521052

10531053
_ = connector
10541054
.stage_transactions_stream(
@@ -1060,7 +1060,7 @@ async fn reorg_changes_outgoing_tx_index() {
10601060
)
10611061
.await;
10621062

1063-
_ = connector.apply_staged(211).await;
1063+
_ = connector.apply_staged(312).await;
10641064

10651065
let reorg_sync_result = light_client.do_sync(true).await;
10661066

darkside-tests/tests/tests.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -181,8 +181,8 @@ async fn sent_transaction_reorged_into_mempool() {
181181
.await
182182
.unwrap();
183183
let connector = DarksideConnector(server_id.clone());
184-
connector.stage_blocks_create(4, 1, 0).await.unwrap();
185-
connector.apply_staged(4).await.unwrap();
184+
connector.stage_blocks_create(4, 102, 0).await.unwrap();
185+
connector.apply_staged(105).await.unwrap();
186186
sleep(std::time::Duration::from_secs(1)).await;
187187

188188
recipient.do_sync(false).await.unwrap();

libtonode-tests/tests/concrete.rs

Lines changed: 6 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -1084,10 +1084,10 @@ mod slow {
10841084
scenarios::faucet_recipient_default().await;
10851085

10861086
// 2. Get an incoming transaction to a t address
1087-
let taddr = get_base_address_macro!(recipient, "transparent");
1087+
let recipient_taddr = get_base_address_macro!(recipient, "transparent");
10881088
let value = 100_000;
10891089

1090-
from_inputs::quick_send(&faucet, vec![(taddr.as_str(), value, None)])
1090+
from_inputs::quick_send(&faucet, vec![(recipient_taddr.as_str(), value, None)])
10911091
.await
10921092
.unwrap();
10931093

@@ -1099,7 +1099,10 @@ mod slow {
10991099
// 3. Test the list
11001100
let list = recipient.do_list_transactions().await;
11011101
assert_eq!(list[0]["block_height"].as_u64().unwrap(), 4);
1102-
assert_eq!(list[0]["address"], taddr);
1102+
assert_eq!(
1103+
recipient.do_addresses().await[0]["receivers"]["transparent"].to_string(),
1104+
recipient_taddr
1105+
);
11031106
assert_eq!(list[0]["amount"].as_u64().unwrap(), value);
11041107

11051108
// 4. We can't spend the funds, as they're transparent. We need to shield first
@@ -3228,69 +3231,6 @@ mod slow {
32283231
serde_json::to_string_pretty(&recipient.do_balance().await).unwrap()
32293232
);
32303233
}
3231-
#[tokio::test]
3232-
async fn dont_write_pending() {
3233-
let regtest_network = RegtestNetwork::all_upgrades_active();
3234-
let (regtest_manager, _cph, faucet, recipient) = scenarios::faucet_recipient(
3235-
PoolType::Shielded(ShieldedProtocol::Orchard),
3236-
regtest_network,
3237-
)
3238-
.await;
3239-
from_inputs::quick_send(
3240-
&faucet,
3241-
vec![(
3242-
&get_base_address_macro!(recipient, "unified"),
3243-
100_000,
3244-
Some("funding to be received by the recipient"),
3245-
)],
3246-
)
3247-
.await
3248-
.unwrap();
3249-
3250-
zingolib::testutils::increase_height_and_wait_for_client(&regtest_manager, &recipient, 2)
3251-
.await
3252-
.unwrap();
3253-
let recipient_balance = recipient.do_balance().await;
3254-
assert_eq!(
3255-
recipient_balance,
3256-
PoolBalances {
3257-
sapling_balance: Some(0),
3258-
verified_sapling_balance: Some(0),
3259-
spendable_sapling_balance: Some(0),
3260-
unverified_sapling_balance: Some(0),
3261-
orchard_balance: Some(100000),
3262-
verified_orchard_balance: Some(100000),
3263-
spendable_orchard_balance: Some(100000),
3264-
unverified_orchard_balance: Some(0),
3265-
transparent_balance: Some(0)
3266-
}
3267-
);
3268-
from_inputs::quick_send(
3269-
&recipient,
3270-
vec![(
3271-
&get_base_address_macro!(faucet, "unified"),
3272-
25_000,
3273-
Some("an pending transaction, that shall not be synced"),
3274-
)],
3275-
)
3276-
.await
3277-
.unwrap();
3278-
let recipient_balance = recipient.do_balance().await;
3279-
3280-
dbg!(&recipient_balance.unverified_orchard_balance);
3281-
assert_eq!(
3282-
recipient_balance.unverified_orchard_balance.unwrap(),
3283-
65_000
3284-
);
3285-
3286-
let loaded_client =
3287-
zingolib::testutils::lightclient::new_client_from_save_buffer(&recipient)
3288-
.await
3289-
.unwrap();
3290-
let loaded_balance = loaded_client.do_balance().await;
3291-
assert_eq!(loaded_balance.unverified_orchard_balance, Some(0),);
3292-
check_client_balances!(loaded_client, o: 100_000 s: 0 t: 0 );
3293-
}
32943234

32953235
#[tokio::test]
32963236
async fn by_address_finsight() {

libtonode-tests/tests/wallet.rs

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -101,37 +101,40 @@ mod load_wallet {
101101
);
102102
let expected_pre_sync_transactions = r#"[
103103
{
104+
"outgoing_metadata": [],
105+
"amount": 100000,
106+
"memo": "null, null",
104107
"block_height": 3,
105108
"pending": false,
106109
"datetime": 1692212261,
107110
"position": 0,
108111
"txid": "7a9d41caca143013ebd2f710e4dad04f0eb9f0ae98b42af0f58f25c61a9d439e",
109-
"amount": 100000,
110112
"zec_price": null,
111-
"address": "uregtest1wdukkmv5p5n824e8ytnc3m6m77v9vwwl7hcpj0wangf6z23f9x0fnaen625dxgn8cgp67vzw6swuar6uwp3nqywfvvkuqrhdjffxjfg644uthqazrtxhrgwac0a6ujzgwp8y9cwthjeayq8r0q6786yugzzyt9vevxn7peujlw8kp3vf6d8p4fvvpd8qd5p7xt2uagelmtf3vl6w3u8",
112-
"memo": null
113+
"address": "uregtest1wdukkmv5p5n824e8ytnc3m6m77v9vwwl7hcpj0wangf6z23f9x0fnaen625dxgn8cgp67vzw6swuar6uwp3nqywfvvkuqrhdjffxjfg644uthqazrtxhrgwac0a6ujzgwp8y9cwthjeayq8r0q6786yugzzyt9vevxn7peujlw8kp3vf6d8p4fvvpd8qd5p7xt2uagelmtf3vl6w3u8"
113114
},
114115
{
116+
"outgoing_metadata": [],
117+
"amount": 50000,
118+
"memo": "null, null",
115119
"block_height": 8,
116120
"pending": false,
117121
"datetime": 1692212266,
118122
"position": 0,
119123
"txid": "122f8ab8dc5483e36256a4fbd7ff8d60eb7196670716a6690f9215f1c2a4d841",
120-
"amount": 50000,
121124
"zec_price": null,
122-
"address": "uregtest1wdukkmv5p5n824e8ytnc3m6m77v9vwwl7hcpj0wangf6z23f9x0fnaen625dxgn8cgp67vzw6swuar6uwp3nqywfvvkuqrhdjffxjfg644uthqazrtxhrgwac0a6ujzgwp8y9cwthjeayq8r0q6786yugzzyt9vevxn7peujlw8kp3vf6d8p4fvvpd8qd5p7xt2uagelmtf3vl6w3u8",
123-
"memo": null
125+
"address": "uregtest1wdukkmv5p5n824e8ytnc3m6m77v9vwwl7hcpj0wangf6z23f9x0fnaen625dxgn8cgp67vzw6swuar6uwp3nqywfvvkuqrhdjffxjfg644uthqazrtxhrgwac0a6ujzgwp8y9cwthjeayq8r0q6786yugzzyt9vevxn7peujlw8kp3vf6d8p4fvvpd8qd5p7xt2uagelmtf3vl6w3u8"
124126
},
125127
{
128+
"outgoing_metadata": [],
129+
"amount": 30000,
130+
"memo": "null, null",
126131
"block_height": 9,
127132
"pending": false,
128133
"datetime": 1692212299,
129134
"position": 0,
130135
"txid": "0a014017add7dc9eb57ada3e70f905c9dce610ef055e135b03f4907dd5dc99a4",
131-
"amount": 30000,
132136
"zec_price": null,
133-
"address": "uregtest1wdukkmv5p5n824e8ytnc3m6m77v9vwwl7hcpj0wangf6z23f9x0fnaen625dxgn8cgp67vzw6swuar6uwp3nqywfvvkuqrhdjffxjfg644uthqazrtxhrgwac0a6ujzgwp8y9cwthjeayq8r0q6786yugzzyt9vevxn7peujlw8kp3vf6d8p4fvvpd8qd5p7xt2uagelmtf3vl6w3u8",
134-
"memo": null
137+
"address": "uregtest1wdukkmv5p5n824e8ytnc3m6m77v9vwwl7hcpj0wangf6z23f9x0fnaen625dxgn8cgp67vzw6swuar6uwp3nqywfvvkuqrhdjffxjfg644uthqazrtxhrgwac0a6ujzgwp8y9cwthjeayq8r0q6786yugzzyt9vevxn7peujlw8kp3vf6d8p4fvvpd8qd5p7xt2uagelmtf3vl6w3u8"
135138
}
136139
]"#;
137140
assert_eq!(
@@ -141,26 +144,28 @@ mod load_wallet {
141144
recipient.do_sync(false).await.unwrap();
142145
let expected_post_sync_transactions = r#"[
143146
{
147+
"outgoing_metadata": [],
148+
"amount": 100000,
149+
"memo": "null, null",
144150
"block_height": 3,
145151
"pending": false,
146152
"datetime": 1692212261,
147153
"position": 0,
148154
"txid": "7a9d41caca143013ebd2f710e4dad04f0eb9f0ae98b42af0f58f25c61a9d439e",
149-
"amount": 100000,
150155
"zec_price": null,
151-
"address": "uregtest1wdukkmv5p5n824e8ytnc3m6m77v9vwwl7hcpj0wangf6z23f9x0fnaen625dxgn8cgp67vzw6swuar6uwp3nqywfvvkuqrhdjffxjfg644uthqazrtxhrgwac0a6ujzgwp8y9cwthjeayq8r0q6786yugzzyt9vevxn7peujlw8kp3vf6d8p4fvvpd8qd5p7xt2uagelmtf3vl6w3u8",
152-
"memo": null
156+
"address": "uregtest1wdukkmv5p5n824e8ytnc3m6m77v9vwwl7hcpj0wangf6z23f9x0fnaen625dxgn8cgp67vzw6swuar6uwp3nqywfvvkuqrhdjffxjfg644uthqazrtxhrgwac0a6ujzgwp8y9cwthjeayq8r0q6786yugzzyt9vevxn7peujlw8kp3vf6d8p4fvvpd8qd5p7xt2uagelmtf3vl6w3u8"
153157
},
154158
{
159+
"outgoing_metadata": [],
160+
"amount": 50000,
161+
"memo": "null, null",
155162
"block_height": 8,
156163
"pending": false,
157164
"datetime": 1692212266,
158165
"position": 0,
159166
"txid": "122f8ab8dc5483e36256a4fbd7ff8d60eb7196670716a6690f9215f1c2a4d841",
160-
"amount": 50000,
161167
"zec_price": null,
162-
"address": "uregtest1wdukkmv5p5n824e8ytnc3m6m77v9vwwl7hcpj0wangf6z23f9x0fnaen625dxgn8cgp67vzw6swuar6uwp3nqywfvvkuqrhdjffxjfg644uthqazrtxhrgwac0a6ujzgwp8y9cwthjeayq8r0q6786yugzzyt9vevxn7peujlw8kp3vf6d8p4fvvpd8qd5p7xt2uagelmtf3vl6w3u8",
163-
"memo": null
168+
"address": "uregtest1wdukkmv5p5n824e8ytnc3m6m77v9vwwl7hcpj0wangf6z23f9x0fnaen625dxgn8cgp67vzw6swuar6uwp3nqywfvvkuqrhdjffxjfg644uthqazrtxhrgwac0a6ujzgwp8y9cwthjeayq8r0q6786yugzzyt9vevxn7peujlw8kp3vf6d8p4fvvpd8qd5p7xt2uagelmtf3vl6w3u8"
164169
}
165170
]"#;
166171
assert_eq!(

zingolib/src/lightclient/describe.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -508,7 +508,7 @@ impl LightClient {
508508
create_send_value_transfers(&mut value_transfers, tx);
509509
}
510510
TransactionKind::Received => {
511-
// create 1 received value tansfer for each pool recieved to
511+
// create 1 received value tansfer for each pool received to
512512
if !tx.orchard_notes().is_empty() {
513513
let value: u64 =
514514
tx.orchard_notes().iter().map(|output| output.value()).sum();

zingolib/src/testutils/chain_generics/with_assertions.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ use crate::testutils::{
1010
};
1111
use zingo_status::confirmation_status::ConfirmationStatus;
1212

13-
/// sends to any combo of recipient clients checks that each recipient also recieved the expected balances
13+
/// sends to any combo of recipient clients checks that each recipient also received the expected balances
1414
/// test-only generic
1515
/// NOTICE this function bumps the chain and syncs the client
1616
/// only compatible with zip317

0 commit comments

Comments
 (0)