-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #505 from quake/quake/fix-force-close-amount-bug
fix: resolve force close amount bug
- Loading branch information
Showing
18 changed files
with
342 additions
and
142 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
tests/bruno/e2e/watchtower/force-close-after-multiple-payments/03-accept-channel.bru
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
meta { | ||
name: node2 accept channel | ||
type: http | ||
seq: 3 | ||
} | ||
|
||
post { | ||
url: {{NODE2_RPC_URL}} | ||
body: json | ||
auth: none | ||
} | ||
|
||
headers { | ||
Content-Type: application/json | ||
Accept: application/json | ||
} | ||
|
||
body:json { | ||
{ | ||
"id": "42", | ||
"jsonrpc": "2.0", | ||
"method": "accept_channel", | ||
"params": [ | ||
{ | ||
"temporary_channel_id": "{{N1N2_TEMP_CHANNEL_ID}}", | ||
"funding_amount": "0x1004ccb00", | ||
"shutdown_script": { | ||
"code_hash": "0x2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d", | ||
"hash_type": "data", | ||
"args": "0x42" | ||
} | ||
} | ||
] | ||
} | ||
} | ||
|
||
assert { | ||
res.body.error: isUndefined | ||
} | ||
|
||
script:post-response { | ||
// Sleep for sometime to make sure current operation finishes before next request starts. | ||
await new Promise(r => setTimeout(r, 1000)); | ||
console.log("accept channel result: ", res.body); | ||
bru.setVar("CHANNEL_ID", res.body.result.channel_id); | ||
} |
40 changes: 0 additions & 40 deletions
40
...bruno/e2e/watchtower/force-close-after-multiple-payments/03-get-auto-accepted-channel.bru
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
tests/bruno/e2e/watchtower/force-close-after-multiple-payments/15-check-balance-node1.bru
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
meta { | ||
name: check balance, 0x24e160300 - 0x2dc6c0 + 0x16e360 - 0x1c7 (fee) == 0x24dff1dd9 | ||
type: http | ||
seq: 15 | ||
} | ||
|
||
post { | ||
url: {{CKB_RPC_URL}} | ||
body: json | ||
auth: none | ||
} | ||
|
||
headers { | ||
Content-Type: application/json | ||
Accept: application/json | ||
} | ||
|
||
body:json { | ||
{ | ||
"id": 42, | ||
"jsonrpc": "2.0", | ||
"method": "get_cells_capacity", | ||
"params": [ | ||
{ | ||
"script": { | ||
"code_hash": "0x2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c", | ||
"hash_type": "data", | ||
"args": "0x42" | ||
}, | ||
"script_type": "lock" | ||
} | ||
] | ||
} | ||
} | ||
|
||
assert { | ||
res.body.result.capacity: eq "0x24dff1dd9" | ||
} | ||
|
||
script:post-response { | ||
console.log("result: ", res.body); | ||
} |
42 changes: 42 additions & 0 deletions
42
tests/bruno/e2e/watchtower/force-close-after-multiple-payments/16-check-balance-node2.bru
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
meta { | ||
name: check balance, 0x1004ccb00 + 0x2dc6c0 - 0x16e360 - 0x1c7 (fee) == 0x10063ac99 | ||
type: http | ||
seq: 16 | ||
} | ||
|
||
post { | ||
url: {{CKB_RPC_URL}} | ||
body: json | ||
auth: none | ||
} | ||
|
||
headers { | ||
Content-Type: application/json | ||
Accept: application/json | ||
} | ||
|
||
body:json { | ||
{ | ||
"id": 42, | ||
"jsonrpc": "2.0", | ||
"method": "get_cells_capacity", | ||
"params": [ | ||
{ | ||
"script": { | ||
"code_hash": "0x2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d", | ||
"hash_type": "data", | ||
"args": "0x42" | ||
}, | ||
"script_type": "lock" | ||
} | ||
] | ||
} | ||
} | ||
|
||
assert { | ||
res.body.result.capacity: eq "0x10063ac99" | ||
} | ||
|
||
script:post-response { | ||
console.log("result: ", res.body); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
tests/bruno/e2e/watchtower/force-close-after-open-channel/03-accept-channel.bru
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
meta { | ||
name: node2 accept channel | ||
type: http | ||
seq: 3 | ||
} | ||
|
||
post { | ||
url: {{NODE2_RPC_URL}} | ||
body: json | ||
auth: none | ||
} | ||
|
||
headers { | ||
Content-Type: application/json | ||
Accept: application/json | ||
} | ||
|
||
body:json { | ||
{ | ||
"id": "42", | ||
"jsonrpc": "2.0", | ||
"method": "accept_channel", | ||
"params": [ | ||
{ | ||
"temporary_channel_id": "{{N1N2_TEMP_CHANNEL_ID}}", | ||
"funding_amount": "0x1004ccb00", | ||
"shutdown_script": { | ||
"code_hash": "0x2f2f2f2f2f2f2f2f2f2f2f2f2f2f2f2f2f2f2f2f2f2f2f2f2f2f2f2f2f2f2f2f", | ||
"hash_type": "data", | ||
"args": "0x42" | ||
} | ||
} | ||
] | ||
} | ||
} | ||
|
||
assert { | ||
res.body.error: isUndefined | ||
} | ||
|
||
script:post-response { | ||
// Sleep for sometime to make sure current operation finishes before next request starts. | ||
await new Promise(r => setTimeout(r, 1000)); | ||
console.log("accept channel result: ", res.body); | ||
bru.setVar("CHANNEL_ID", res.body.result.channel_id); | ||
} |
40 changes: 0 additions & 40 deletions
40
tests/bruno/e2e/watchtower/force-close-after-open-channel/03-get-auto-accepted-channel.bru
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.