Skip to content
This repository has been archived by the owner on Apr 23, 2024. It is now read-only.

sdk/agent: implement event handling with channels #257

Merged
merged 50 commits into from
Aug 27, 2021
Merged
Changes from 1 commit
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
4f75e29
sdk/agent: make open/pay/close ops consistently async
leighmcculloch Aug 21, 2021
0d63856
Merge branch 'main' into issue224
leighmcculloch Aug 21, 2021
764dca2
sdk/agent: add event handlers (wip)
leighmcculloch Aug 21, 2021
442b88b
1
leighmcculloch Aug 23, 2021
392b170
sdk/agent: move logic for determining initiator to a func
leighmcculloch Aug 23, 2021
ad74b3b
Merge branch 'smll' into issue226
leighmcculloch Aug 23, 2021
fe5db7e
wip
leighmcculloch Aug 23, 2021
1969226
sdk/agent: add todo to remove logic
leighmcculloch Aug 23, 2021
ff00ff0
Merge branch 'todoit' into issue226
leighmcculloch Aug 23, 2021
89a7d30
wip
leighmcculloch Aug 24, 2021
3326e5e
Merge branch 'main' into issue226
leighmcculloch Aug 24, 2021
32a8da7
wip
leighmcculloch Aug 24, 2021
4474a63
sdk/agent: move channel creation into open process
leighmcculloch Aug 24, 2021
e50696b
make the initiator the open proposer
leighmcculloch Aug 24, 2021
a7973dc
Merge branch 'moveinit' into issue226
leighmcculloch Aug 24, 2021
5214249
Reduce changes
leighmcculloch Aug 24, 2021
85d1a53
on error in more cases
leighmcculloch Aug 24, 2021
3430c58
simplify
leighmcculloch Aug 24, 2021
487092f
simplify
leighmcculloch Aug 24, 2021
b1d0248
consistent error message
leighmcculloch Aug 24, 2021
2a3f943
log error
leighmcculloch Aug 24, 2021
4232962
group
leighmcculloch Aug 24, 2021
77dc195
Merge branch 'moveinit' into issue226
leighmcculloch Aug 24, 2021
6ddb567
event handling
leighmcculloch Aug 24, 2021
d653992
remove defer
leighmcculloch Aug 24, 2021
c514fab
wip
leighmcculloch Aug 24, 2021
7a03c0e
wip
leighmcculloch Aug 26, 2021
dd55482
remove todos
leighmcculloch Aug 26, 2021
9388e31
test passing
leighmcculloch Aug 26, 2021
f8743b4
logger resilience
leighmcculloch Aug 26, 2021
6c2750b
Revert "logger resilience"
leighmcculloch Aug 26, 2021
e9f9c38
ignore logs
leighmcculloch Aug 26, 2021
22a4aa4
Merge branch 'main' into issue226
leighmcculloch Aug 26, 2021
1d73c0e
sdk/agent: repair failing payment due to stale balance data
leighmcculloch Aug 26, 2021
ae1584b
Merge branch 'underfundedagent' into issue226
leighmcculloch Aug 26, 2021
19d17c7
strip event handlers from change
leighmcculloch Aug 26, 2021
811d0b8
sdk/agent: add event handlers
leighmcculloch Aug 26, 2021
f23ad1e
remove event handlers
leighmcculloch Aug 26, 2021
a8fbd45
fix fmt
leighmcculloch Aug 26, 2021
f49e8e0
Merge branch 'firsttest' into issue226
leighmcculloch Aug 26, 2021
cbebf39
sdk/agent: implement event handling with channels
leighmcculloch Aug 26, 2021
0da9720
fmt
leighmcculloch Aug 26, 2021
e1025da
use in example
leighmcculloch Aug 26, 2021
d364d98
small tweak to make tests more reliable in failure
leighmcculloch Aug 26, 2021
9ec0039
fix lint
leighmcculloch Aug 26, 2021
b1a5b9c
Merge branch 'main' into issue226-channels
leighmcculloch Aug 27, 2021
f807c68
fix ineffectual assignment
leighmcculloch Aug 27, 2021
626e9bf
Merge branch 'main' into issue226-channels
leighmcculloch Aug 27, 2021
4aae901
remove and confirmed
leighmcculloch Aug 27, 2021
adca781
fix example
leighmcculloch Aug 27, 2021
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
Prev Previous commit
Next Next commit
remove todos
  • Loading branch information
leighmcculloch committed Aug 26, 2021
commit dd5548217c763254af71b83204ef86204a18ec56
4 changes: 0 additions & 4 deletions sdk/agent/agent.go
Original file line number Diff line number Diff line change
@@ -169,8 +169,6 @@ func (a *Agent) Payment(paymentAmount string) error {
}
ca, err := a.channel.ProposePayment(amountValue)
if errors.Is(err, state.ErrUnderfunded) {
// TODO: Remove this logic once the agent is ingesting transactions and
// updating account balance that way.
fmt.Fprintf(a.LogWriter, "local is underfunded for this payment based on cached account balances, checking escrow account...\n")
var balance int64
balance, err = a.BalanceCollector.GetBalance(a.channel.LocalEscrowAccount().Address, a.channel.OpenAgreement().Details.Asset)
@@ -404,8 +402,6 @@ func (a *Agent) handlePaymentRequest(m msg.Message, send *msg.Encoder) error {
paymentIn := *m.PaymentRequest
payment, err := a.channel.ConfirmPayment(paymentIn)
if errors.Is(err, state.ErrUnderfunded) {
// TODO: Remove this logic once the agent is ingesting transactions and
// updating account balance that way.
fmt.Fprintf(a.LogWriter, "remote is underfunded for this payment based on cached account balances, checking their escrow account...\n")
var balance int64
balance, err = a.BalanceCollector.GetBalance(a.channel.RemoteEscrowAccount().Address, a.channel.OpenAgreement().Details.Asset)