<commit_before>package main

import (
	"testing"

	"github.com/NebulousLabs/Sia/modules"
)

// TestSendCoins creates two addresses and sends coins from one to the other.
// The first balance should decrease, and the second balance should increase
// proportionally.
func TestSendCoins(t *testing.T) {
	sender := newDaemonTester(t)
	receiver := sender.addPeer()

	// need to mine a few coins first
	sender.mineBlock()

	// get current balances
	var oldSenderStatus modules.WalletInfo
	sender.getAPI("/wallet/status", &oldSenderStatus)
	var oldReceiverStatus modules.WalletInfo
	receiver.getAPI("/wallet/status", &oldReceiverStatus)

	// get an address from the receiver
	var addr struct {
		Address string
	}
	receiver.getAPI("/wallet/address", &addr)

	// send 3e4 coins from the sender to the receiver
	sender.callAPI("/wallet/send?amount=30000&dest=" + addr.Address)
	// wait until the transaction is relayed to the receiver
	<-receiver.rpcChan
	<-receiver.rpcChan
	<-sender.rpcChan
	<-sender.rpcChan

	// get updated balances
	var newSenderStatus modules.WalletInfo
	sender.getAPI("/wallet/status", &newSenderStatus)
	var newReceiverStatus modules.WalletInfo
	receiver.getAPI("/wallet/status", &newReceiverStatus)

	// sender balance should have gone down
	if newSenderStatus.FullBalance.Cmp(oldSenderStatus.FullBalance) >= 0 {
		t.Fatalf("Sender balance should have gone down:\n\told: %v\n\tnew: %v", oldSenderStatus.FullBalance.Big(), newSenderStatus.FullBalance.Big())
	}
	// receiver balance should have gone up
	if newReceiverStatus.FullBalance.Cmp(oldReceiverStatus.FullBalance) <= 0 {
		t.Fatalf("Receiver balance should have gone up:\n\told: %v\n\tnew: %v", oldReceiverStatus.FullBalance.Big(), newReceiverStatus.FullBalance.Big())
	}
}<commit_msg>fix deadlock<commit_after>package main

import (
	"testing"

	"github.com/NebulousLabs/Sia/modules"
)

// TestSendCoins creates two addresses and sends coins from one to the other.
// The first balance should decrease, and the second balance should increase
// proportionally.
func TestSendCoins(t *testing.T) {
	sender := newDaemonTester(t)
	receiver := sender.addPeer()

	// need to mine a few coins first
	sender.mineBlock()

	// get current balances
	var oldSenderStatus modules.WalletInfo
	sender.getAPI("/wallet/status", &oldSenderStatus)
	var oldReceiverStatus modules.WalletInfo
	receiver.getAPI("/wallet/status", &oldReceiverStatus)

	// get an address from the receiver
	var addr struct {
		Address string
	}
	receiver.getAPI("/wallet/address", &addr)

	// send 3e4 coins from the sender to the receiver
	sender.callAPI("/wallet/send?amount=30000&dest=" + addr.Address)
	// wait until the transaction is relayed to the receiver
	<-receiver.rpcChan
	<-receiver.rpcChan
	//<-sender.rpcChan
	//<-sender.rpcChan

	// get updated balances
	var newSenderStatus modules.WalletInfo
	sender.getAPI("/wallet/status", &newSenderStatus)
	var newReceiverStatus modules.WalletInfo
	receiver.getAPI("/wallet/status", &newReceiverStatus)

	// sender balance should have gone down
	if newSenderStatus.FullBalance.Cmp(oldSenderStatus.FullBalance) >= 0 {
		t.Fatalf("Sender balance should have gone down:\n\told: %v\n\tnew: %v", oldSenderStatus.FullBalance.Big(), newSenderStatus.FullBalance.Big())
	}
	// receiver balance should have gone up
	if newReceiverStatus.FullBalance.Cmp(oldReceiverStatus.FullBalance) <= 0 {
		t.Fatalf("Receiver balance should have gone up:\n\told: %v\n\tnew: %v", oldReceiverStatus.FullBalance.Big(), newReceiverStatus.FullBalance.Big())
	}
}
{'fraction_non_alphanumeric': 0.1136040897472309, 'fraction_numerical': 0.005112184038625391, 'mean_word_length': 4.736156351791531, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1833095', 'n_tokens_mistral': 1119, 'n_tokens_neox': 1101, 'n_words': 291}