     (is (= 1 (q/chain-length @db/db)))))
 
 (deftest test-forwarding-received-blocks-to-peers
-  (q/add-peer! db/db {:port test-port-2 :host "127.0.0.1"})
+  (q/add-peer! db/db {:port test-port :host "127.0.0.1"})
   (let [b (miner/mine (blocks/generate-block [(miner/coinbase)]))]
     (handler {:message "submit_block" :payload b} sock-info)
     (is (= 1 (q/chain-length @db/db)))


(defn json-body [req] (read-json (:body req)))
(deftest test-forwarding-mined-blocks-to-peers
  (q/add-peer! db/db {:port test-port-2 :host "127.0.0.1"})
  (miner/mine-and-commit-db)
  (is (= 1 (q/chain-length @db/db)))
  (is (= 1 (count (mapcat val @peer-requests))))

  (miner/mine-and-commit-db)
  (is (= 0 (count @db/transaction-pool)))
  (let [txn (miner/generate-payment wallet/keypair (:address wallet/keypair) 25 (q/longest-chain @db/db))]
    (handler {:message "add_peer" :payload {:port test-port}} sock-info)
    ;; send same txn twice but should only get forwarded once
    (is (= {:message "transaction-accepted" :payload txn}
           (handler {:message "submit_transaction" :payload txn} sock-info)))
