示例#1
0
func notifySpentData(n ntfnChan, txhash *btcwire.ShaHash, index uint32,
	spender *btcutil.Tx) {

	var buf bytes.Buffer
	// Ignore Serialize's error, as writing to a bytes.buffer
	// cannot fail.
	spender.MsgTx().Serialize(&buf)
	txStr := hex.EncodeToString(buf.Bytes())

	ntfn := btcws.NewTxSpentNtfn(txhash.String(), int(index), txStr)
	n <- ntfn
}
示例#2
0
func notifySpentData(wallet walletChan, txhash *btcwire.ShaHash, index uint32,
	spender *btcutil.Tx) {

	var buf bytes.Buffer
	// Ignore Serialize's error, as writing to a bytes.buffer
	// cannot fail.
	spender.MsgTx().Serialize(&buf)
	txStr := hex.EncodeToString(buf.Bytes())

	// TODO(jrick): create a new notification in btcws and use that.
	ntfn := btcws.NewTxSpentNtfn(txhash.String(), int(index), txStr)
	mntfn, _ := ntfn.MarshalJSON()
	wallet <- mntfn
}
示例#3
0
				1386944019,
				0)
		},
		result: &btcws.TxMinedNtfn{
			TxID:        "062f2b5f7d28c787e0f3aee382132241cd590efb7b83bd2c7f506de5aa4ef275",
			BlockHash:   "000000004811dda1c320ad5d0ea184a20a53acd92292c5f1cb926c3ee82abf70",
			BlockHeight: 153469,
			BlockTime:   1386944019,
			Index:       0,
		},
	},
	{
		name: "txspent",
		f: func() btcjson.Cmd {
			return btcws.NewTxSpentNtfn(
				"b22eb08001da1d57aec3131ccb46ea61820c46c71695a802585fbd56e93625a9",
				1,
				"0100000001a92536e956bd5f5802a89516c7460c8261ea46cb1c13c3ae571dda0180b02eb2010000006a4730440220240e3ad18a0393e9894120eb87ded8545222df4890cf98a55b5d36042c966898022031bbd795453fcd01b2a9eb30a8cbbe0ea043b7e4e85ff17ba2b44c243d14aafc0121028031f92546ff86436802fdfe07dc9e1876b70c8b8fa29ca9e9c90664d7022717ffffffff0200ab9041000000001976a91401f65945e042b5e09ecf0a9d9115adecb4caee8588ac703fbc0d040000001976a914c31a4d3e819598e55ff80601e4b2c662454385ca88ac00000000")
		},
		result: &btcws.TxSpentNtfn{
			SpentTxId:       "b22eb08001da1d57aec3131ccb46ea61820c46c71695a802585fbd56e93625a9",
			SpentTxOutIndex: 1,
			SpendingTx:      "0100000001a92536e956bd5f5802a89516c7460c8261ea46cb1c13c3ae571dda0180b02eb2010000006a4730440220240e3ad18a0393e9894120eb87ded8545222df4890cf98a55b5d36042c966898022031bbd795453fcd01b2a9eb30a8cbbe0ea043b7e4e85ff17ba2b44c243d14aafc0121028031f92546ff86436802fdfe07dc9e1876b70c8b8fa29ca9e9c90664d7022717ffffffff0200ab9041000000001976a91401f65945e042b5e09ecf0a9d9115adecb4caee8588ac703fbc0d040000001976a914c31a4d3e819598e55ff80601e4b2c662454385ca88ac00000000",
		},
	},
	{
		name: "newtx",
		f: func() btcjson.Cmd {
			details := map[string]interface{}{
				"key1": float64(12345),
				"key2": true,
				"key3": "lalala",