Hot Fixes for Last Patchset

Christopher Vollick created

Oops, I deleted the `done` variable in the migration and forgot to put
it back, and then I didn't notice that I never passed through the
`confirmations` method to the electrum transaction, because it's used in
the bin logic, but none of the tested logic.

And since I'm now delegating two methods, I may as well use a real
delegator. I thought about it with the first one, but it seemed about 6
in one, half dozen in the other, but with two it starts swinging in the
direction of Forwardable for me.

Change summary

bin/process_pending_btc_transactions | 4 ++--
lib/pending_transaction_repo.rb      | 8 ++++----
2 files changed, 6 insertions(+), 6 deletions(-)

Detailed changes

bin/process_pending_btc_transactions 🔗

@@ -230,7 +230,7 @@ repo.error_handler do |e|
 	end
 end
 
-repo.map do |pending, customer_id|
+done = repo.map { |pending, customer_id|
 	next unless pending.confirmations >= CONFIG[:required_confirmations]
 
 	if pending.outgoing?
@@ -251,6 +251,6 @@ repo.map do |pending, customer_id|
 			warn "No plan for #{customer_id} cannot save #{pending.txid}"
 		end
 	end
-end
+}
 
 puts done.join("\n")

lib/pending_transaction_repo.rb 🔗

@@ -1,18 +1,18 @@
 # frozen_string_literal: true
 
 require "lazy_object"
+require "forwardable"
 
 class PendingTransactionRepo
 	class PendingTransaction
+		extend Forwardable
+		def_delegators :@tx, :tx_hash, :confirmations
+
 		def initialize(tx, address)
 			@tx = tx
 			@address = address
 		end
 
-		def tx_hash
-			@tx.tx_hash
-		end
-
 		def txid
 			"#{tx_hash}/#{@address}"
 		end