inertia186 / radiator

Hive Ruby API Client
https://hive.blog/hive-139531/@inertia/radiator-v0-4-8-hive-ruby-api-client-eclipse-update
Other
50 stars 22 forks source link

response = tx.process(true) -->sometimes it gives this error --> undefined method `[]' for nil:NilClass #10

Closed Nerossoul closed 6 years ago

Nerossoul commented 6 years ago

radiator works good! but sometimes i got a error, see next text code tx = Radiator::Transaction.new(wif: wif_key, chain: :golos, url: 'https://ws.golos.io') tx.operations << transaction_data begin response = tx.process(true) rescue Exception => e puts "forward this message to inertia186/radiator" puts e.message print e.backtrace.join("\n") end

error undefined method []' for nil:NilClass /home/user/.rvm/gems/ruby-2.4.0/gems/radiator-0.3.12/lib/radiator/api.rb:655:inblock (2 levels) in recover_transaction' /home/user/.rvm/gems/ruby-2.4.0/gems/radiator-0.3.12/lib/radiator/api.rb:646:in each' /home/user/.rvm/gems/ruby-2.4.0/gems/radiator-0.3.12/lib/radiator/api.rb:646:ineach_with_index' /home/user/.rvm/gems/ruby-2.4.0/gems/radiator-0.3.12/lib/radiator/api.rb:646:in block in recover_transaction' /home/user/.rvm/gems/ruby-2.4.0/gems/radiator-0.3.12/lib/radiator/api.rb:279:inblock in get_blocks' /home/user/.rvm/gems/ruby-2.4.0/gems/radiator-0.3.12/lib/radiator/api.rb:278:in each' /home/user/.rvm/gems/ruby-2.4.0/gems/radiator-0.3.12/lib/radiator/api.rb:278:inget_blocks' /home/user/.rvm/gems/ruby-2.4.0/gems/radiator-0.3.12/lib/radiator/api.rb:639:in recover_transaction' /home/user/.rvm/gems/ruby-2.4.0/gems/radiator-0.3.12/lib/radiator/api.rb:433:inblock in method_missing' /home/user/.rvm/gems/ruby-2.4.0/gems/radiator-0.3.12/lib/radiator/api.rb:423:in loop' /home/user/.rvm/gems/ruby-2.4.0/gems/radiator-0.3.12/lib/radiator/api.rb:423:inmethod_missing' /home/user/.rvm/gems/ruby-2.4.0/gems/radiator-0.3.12/lib/radiator/transaction.rb:87:in block in process' /home/user/.rvm/gems/ruby-2.4.0/gems/radiator-0.3.12/lib/radiator/transaction.rb:86:inloop' /home/user/.rvm/gems/ruby-2.4.0/gems/radiator-0.3.12/lib/radiator/transaction.rb:86:in `process'

inertia186 commented 6 years ago

It's a known issue on Golos. The problem can be lessened by picking a more reliable node. But until this is actually fixed in radiator, you can pass an the argument recover_transactions_on_error: false to stop radiator from trying to recover the transaction, .e.g.:

tx = Radiator::Transaction.new(wif: wif_key, chain: :golos, url: 'https://ws.golos.io', recover_transactions_on_error: false)

Keep in mind, often this error means that the node accepted the transaction but could not reply due to timeout. If you re-try the transaction, it could result in a duplicate broadcast. This is especially problematic if the transaction contains a transfer of funds and it is blindly retried after the error.

inertia186 commented 6 years ago

See: #26