-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* fix: hexes_to_bins method in special value has bug Signed-off-by: Miles Zhang <[email protected]> * feat: handle unknown status tx Signed-off-by: Miles Zhang <[email protected]> --------- Signed-off-by: Miles Zhang <[email protected]>
- Loading branch information
1 parent
b615030
commit d7faa64
Showing
7 changed files
with
107 additions
and
51 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
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
Large diffs are not rendered by default.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,31 @@ | ||
require "test_helper" | ||
|
||
class PoolTransactionCheckWorkerTest < ActiveSupport::TestCase | ||
setup do | ||
test "should marked tx to rejected when rpc returns rejected" do | ||
CkbSync::Api.any_instance.stubs(:generate_json_rpc_id).returns(1) | ||
rejected_tx_id = "0xed2049c21ffccfcd26281d60f8f77ff117adb9df9d3f8cbe5fe86e893c66d359" | ||
@pending_tx = create(:pending_transaction, | ||
tx_hash: rejected_tx_id, created_at: 10.minutes.ago) | ||
pending_tx = create(:pending_transaction, | ||
tx_hash: rejected_tx_id, created_at: 10.minutes.ago) | ||
|
||
Sidekiq::Testing.inline! | ||
VCR.use_cassette("get_rejected_transaction") do | ||
PoolTransactionCheckWorker.perform_async | ||
assert_equal "rejected", pending_tx.reload.tx_status | ||
assert pending_tx.detailed_message.include?("Resolve failed Dead") | ||
end | ||
end | ||
|
||
test "should detect and mark failed tx from pending tx, for inputs" do | ||
test "should marked tx to rejected when rpc returns unknown" do | ||
CkbSync::Api.any_instance.stubs(:generate_json_rpc_id).returns(2) | ||
unknown_tx_id = "0x1cebe4b6ddae45264790835200fe3a4efdc58e3474e552aff2246eb42b79ed2c" | ||
pending_tx = create(:pending_transaction, | ||
tx_hash: unknown_tx_id, created_at: 10.minutes.ago) | ||
|
||
Sidekiq::Testing.inline! | ||
VCR.use_cassette("get_rejected_transaction") do | ||
PoolTransactionCheckWorker.perform_async | ||
assert_equal "rejected", @pending_tx.reload.tx_status | ||
assert @pending_tx.detailed_message.include?("Resolve failed Dead") | ||
assert_equal "rejected", pending_tx.reload.tx_status | ||
assert pending_tx.detailed_message.include?("unknown") | ||
end | ||
end | ||
end |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.