Skip to content

Add HostPublicKey to RenterContract

Luke Champine requested to merge pubkey into master

This is basically the bare minimum required to add the field. It is not present in the API, though we can easily add it. I will write a test to confirm that loading old contracts correctly fills in their pubkey. I will also test this manually using my personal contracts.

I encountered a NDF in TestIntegrationReplaceOffline. It appears to be a deadlock in the host/miner:

goroutine 193 [semacquire, 8 minutes]:
sync.runtime_Semacquire(0xc420c03074)
	/usr/local/go/src/runtime/sema.go:47 +0x30
sync.(*Mutex).Lock(0xc420c03070)
	/usr/local/go/src/sync/mutex.go:85 +0xde
sync.(*RWMutex).Lock(0xc420c03070)
	/usr/local/go/src/sync/rwmutex.go:86 +0x49
github.com/NebulousLabs/Sia/modules/host.(*Host).ProcessConsensusChange(0xc420c02c00, 0x63bd18682e3289b6, 0xdc1a11c279864276, 0xb9cceb18752726a, 0x7f507ae4b192fbf7, 0x0, 0x0, 0x0, 0xc420a342a0, 0x1, ...)
	/home/luke/go/src/github.com/NebulousLabs/Sia/modules/host/update.go:125 +0x80
github.com/NebulousLabs/Sia/modules/consensus.(*ConsensusSet).readlockUpdateSubscribers(0xc420cd3b80, 0x0, 0x0, 0x0, 0xc4203daea0, 0x1, 0x1)
	/home/luke/go/src/github.com/NebulousLabs/Sia/modules/consensus/subscribe.go:113 +0x240
github.com/NebulousLabs/Sia/modules/consensus.(*ConsensusSet).managedAcceptBlock(0xc420cd3b80, 0x3bfd9c4fc594a60f, 0xc55132422bc5fbf5, 0xc64015502004e225, 0x644048ee8465f732, 0x1, 0x589d01d3, 0xc4210bfd80, 0x1, 0x1, ...)
	/home/luke/go/src/github.com/NebulousLabs/Sia/modules/consensus/accept.go:287 +0x2f5
github.com/NebulousLabs/Sia/modules/consensus.(*ConsensusSet).AcceptBlock(0xc420cd3b80, 0x3bfd9c4fc594a60f, 0xc55132422bc5fbf5, 0xc64015502004e225, 0x644048ee8465f732, 0x1, 0x589d01d3, 0xc4210bfd80, 0x1, 0x1, ...)
	/home/luke/go/src/github.com/NebulousLabs/Sia/modules/consensus/accept.go:307 +0x11c
github.com/NebulousLabs/Sia/modules/miner.(*Miner).AddBlock(0xc420bb6fc0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
	/home/luke/go/src/github.com/NebulousLabs/Sia/modules/miner/testminer.go:73 +0x189
github.com/NebulousLabs/Sia/modules/renter/contractor.TestIntegrationReplaceOffline(0xc4203b46c0)
	/home/luke/go/src/github.com/NebulousLabs/Sia/modules/renter/contractor/uptime_test.go:100 +0xb59
goroutine 2070 [semacquire, 8 minutes]:
sync.runtime_Semacquire(0xc420cd3d54)
	/usr/local/go/src/runtime/sema.go:47 +0x30
sync.(*RWMutex).RLock(0xc420cd3d48)
	/usr/local/go/src/sync/rwmutex.go:43 +0x95
github.com/NebulousLabs/demotemutex.(*DemoteMutex).RLock(0xc420cd3d40)
	/home/luke/go/src/github.com/NebulousLabs/demotemutex/demotemutex.go:42 +0x3f
github.com/NebulousLabs/Sia/modules/consensus.(*ConsensusSet).LockedTryTransactionSet(0xc420cd3b80, 0xc420503140, 0x0, 0x0)
	/home/luke/go/src/github.com/NebulousLabs/Sia/modules/consensus/validtransaction.go:383 +0xcf
github.com/NebulousLabs/Sia/modules/transactionpool.(*TransactionPool).AcceptTransactionSet(0xc420b74750, 0xc420141800, 0x3, 0x4, 0xc420079d00, 0x0)
	/home/luke/go/src/github.com/NebulousLabs/Sia/modules/transactionpool/accept.go:322 +0x179
github.com/NebulousLabs/Sia/modules/host.(*Host).addStorageObligation(0xc420c02c00, 0x0, 0x0, 0x0, 0x0, 0xc420079d40, 0x2, 0x7, 0x0, 0xc420502150, ...)
	/home/luke/go/src/github.com/NebulousLabs/Sia/modules/host/storageobligations.go:374 +0x1213
github.com/NebulousLabs/Sia/modules/host.(*Host).managedFinalizeContract.func2(0xc420c02c00, 0xc420b88288, 0xc420b88a30, 0xc54be0, 0xc421024000, 0x0, 0x0)
	/home/luke/go/src/github.com/NebulousLabs/Sia/modules/host/negotiate.go:259 +0xc9
github.com/NebulousLabs/Sia/modules/host.(*Host).managedFinalizeContract(0xc420c02c00, 0xc54be0, 0xc421024000, 0xb9173f0dc5969142, 0x1be62c21c028e7d5, 0x94b77c5345a4f4e0, 0xc46f8900d781085c, 0xc4200c1b80, 0x1, 0x1, ...)
	/home/luke/go/src/github.com/NebulousLabs/Sia/modules/host/negotiate.go:275 +0xc2f
github.com/NebulousLabs/Sia/modules/host.(*Host).managedRPCFormContract(0xc420c02c00, 0xc53920, 0xc4200908a0, 0x0, 0x0)
	/home/luke/go/src/github.com/NebulousLabs/Sia/modules/host/negotiateformcontract.go:174 +0x169d
github.com/NebulousLabs/Sia/modules/host.(*Host).threadedHandleConn(0xc420c02c00, 0xc53920, 0xc4200908a0)
	/home/luke/go/src/github.com/NebulousLabs/Sia/modules/host/network.go:154 +0x982
created by github.com/NebulousLabs/Sia/modules/host.(*Host).threadedListen
	/home/luke/go/src/github.com/NebulousLabs/Sia/modules/host/network.go:197 +0xcb

Merge request reports