Skip to content

Commit

Permalink
test: add recreate account unit test + update doc
Browse files Browse the repository at this point in the history
Signed-off-by: Minh Huy Tran <[email protected]>
  • Loading branch information
NhoxxKienn committed Jun 26, 2024
1 parent 0219759 commit abb8801
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 31 deletions.
33 changes: 2 additions & 31 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,37 +40,8 @@ The `Dialer` requires the other peers to be already "registered" to connect with

Example (register peer before propose a channel with them):
````go
// OpenChannel opens a new channel with the specified peer and funding.
func (c *PaymentClient) OpenChannel(peer wire.Address, peerID string, amount float64) *PaymentChannel {
....
```
c.net.Dialer.Register(peer, peerID)
```
...

// Prepare the channel proposal by defining the channel parameters.
challengeDuration := uint64(10) // On-chain challenge duration in seconds.
proposal, err := client.NewLedgerChannelProposal(
challengeDuration,
c.account,
initAlloc,
participants,
)
if err != nil {
panic(err)
}

// Send the proposal.
ch, err := c.perunClient.ProposeChannel(context.TODO(), proposal)
if err != nil {
panic(err)
}

// Start the on-chain event watcher. It automatically handles disputes.
c.startWatching(ch)

return newPaymentChannel(ch, c.currency)
}
// Must be called at least once before attempting to connect with peer.
net.Dialer.Register(peer, peerID)
````

## Address Ressolver
Expand Down
1 change: 1 addition & 0 deletions p2p/account_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -223,4 +223,5 @@ func TestNewAccountFromPrivateKey(t *testing.T) {
assert.NoError(t, err)
assert.NotNil(t, acc2)
assert.Equal(t, acc.ID(), acc2.ID())
assert.Equal(t, acc.Address(), acc2.Address())
}

0 comments on commit abb8801

Please sign in to comment.