diff --git a/app/btc-wallet-hook.hoon b/app/btc-wallet-hook.hoon index 73479152e..36c059273 100644 --- a/app/btc-wallet-hook.hoon +++ b/app/btc-wallet-hook.hoon @@ -199,14 +199,25 @@ :: add to wallet-store history :: send message to peer `state - :: - %expect-payment - ::TODO :: - check that src.bowl isn't past piym-limit in pend-piym :: - check that payment is in piym :: - add to pend-piym - :: - retry pend-piym - `state + :: - send tx-info to provider (poke) + :: + %expect-payment + ~|("Too many %expect-payment sent, or payer+value not found in incoming payments") + =+ num-pend (~(gut by num.pend-piym) payer.act 0) + ?> (gte piym-limit num-pend) + =+ pay=(~(get by ps.piym) payer.act) + ?~ pay !! + ?> ?& =(payer.u.pay payer.act) + =(value.u.pay value.act) + == + :- ~[(get-tx-info txid.act)] + %= state + ps.pend-piym (~(put by ps.pend-piym) txid u.pay) + num.pend-piym +(num-pend) + == :: %clear-poym `state(poym ~) @@ -390,6 +401,14 @@ %poke %btc-provider-action !>([ri %raw-tx txid]) == :: +++ get-tx-info + |= [host=ship =txid] + ^- card + =/ ri=req-id:bp (gen-req-id:bp eny.bowl) + :* %pass /[(scot %da now.bowl)] %agent [host %btc-provider] + %poke %btc-provider-action !>([ri %tx-info txid]) + == +:: ++ provider-connected ^- ? ?~ provider %.n diff --git a/app/btc-wallet-store.hoon b/app/btc-wallet-store.hoon index 5a8be82ef..7355aecf7 100644 --- a/app/btc-wallet-store.hoon +++ b/app/btc-wallet-store.hoon @@ -120,8 +120,10 @@ (update-address +.act) :: %tx-info - :: TODO: update history as these come. Check confs - :: if address in wach and confs low and this txid not there, request %address-info + :: TODO: + :: - check whether this txid in any hest map + :: - update history as these come. Check confs + :: - if address in wach and confs low and this txid not there, request %address-info `state :: %generate-address @@ -136,6 +138,13 @@ ?~ t ~&(>>> "btc-wallet-store: insufficient balance" `state) :_ state ~[(send-update [%generate-txbu xpub.act u.t])] + :: + %add-history-entry + :: TODO + :: - create map for xpub if doesn't exist + :: - add the hest + :: - send a tx-info request out + `state == :: wallet scan algorithm: :: Initiate a batch for each chyg, with max-gap idxs in it diff --git a/sur/btc-wallet-hook.hoon b/sur/btc-wallet-hook.hoon index 985f98b81..3911b9c90 100644 --- a/sur/btc-wallet-hook.hoon +++ b/sur/btc-wallet-hook.hoon @@ -34,7 +34,7 @@ [%gen-pay-address value=sats] [%ret-pay-address =address payer=ship value=sats] [%broadcast-tx signed-psbt=cord] - [%expect-payment payer=ship value=sats] + [%expect-payment =txid payer=ship value=sats] [%clear-poym ~] [%force-retry ~] == diff --git a/sur/btc-wallet-store.hoon b/sur/btc-wallet-store.hoon index 0a00dc0aa..4b8a874af 100644 --- a/sur/btc-wallet-store.hoon +++ b/sur/btc-wallet-store.hoon @@ -91,7 +91,7 @@ [%address-info =xpub =chyg =idx utxos=(set utxo) used=? block=@ud] [%generate-address =xpub =chyg =peta] [%generate-txbu =xpub payee=(unit ship) feyb=sats txos=(list txo)] - [%add-history-entry =hest] + [%add-history-entry =xpub =hest] == :: +$ update