tips: grin config gate, reorg sweep_txid preservation, LWS import retry

- config: grin is a supported tip chain (voucher model verified against the node),
  so FEATURE_TIPS with only grin enabled no longer fails closed at boot.
- social_tips: revert_sweep_on_reorg now preserves sweep_txid instead of nulling
  it. Address-scan chains (btc/ltc/xmr/wow) overwrite it via confirm_sweep_onchain
  on the next cycle, so preserving the orphaned value is harmless; grin needs the
  kernel excess to re-date a re-mined sweep via get_kernel, so nulling it stranded
  reorged grin tips in 'claiming'. Test updated to assert preservation.
- lws import_account: retry the birthday backfill rescan (3 attempts, backoff) so
  a transient failure no longer strands a new account at the chain tip. The
  already-registered Some(_) no-op is unchanged, so this cannot reintroduce the
  balance-reset bug.
This commit is contained in:
jwinterm
2026-07-11 12:21:03 -04:00
parent 533f945290
commit c5c8dd5bf1
4 changed files with 49 additions and 17 deletions
+8 -4
View File
@@ -601,7 +601,10 @@ async fn confirm_sweep_onchain_settles_claiming_only() {
}
/// (d) revert_sweep_on_reorg reverts 'claimed' -> 'claiming' ONLY, clearing the
/// sweep witness (incl. sweep_txid so the next cycle records the new winner).
/// settlement witness (sweep_confirmed_at, block height/hash) but PRESERVING
/// sweep_txid. Address-scan chains overwrite it via confirm_sweep_onchain on the
/// next cycle; grin (voucher) needs it to re-date the re-mined sweep via
/// get_kernel, so nulling it would strand the row in 'claiming'.
#[tokio::test]
async fn revert_sweep_on_reorg_only_from_claimed() {
let Some(app) = tips_app().await else { return };
@@ -612,9 +615,10 @@ async fn revert_sweep_on_reorg_only_from_claimed() {
let reverted = app.state.db.revert_sweep_on_reorg(id).await.expect("revert").expect("reverted row");
assert_eq!(reverted.status, "claiming");
assert!(reverted.sweep_confirmed_at.is_none());
assert!(
reverted.sweep_txid.is_none(),
"reorg clears sweep_txid so the next confirm cycle records the new on-chain winner"
assert_eq!(
reverted.sweep_txid.as_deref(),
Some("onchain-swp"),
"reorg preserves sweep_txid: address-scan chains overwrite it next cycle, grin needs it to re-date via get_kernel"
);
assert!(reverted.sweep_block_height.is_none());