Created
April 7, 2019 16:40
-
-
Save farukterzioglu/01467b528ffeece11178cffebf6bf930 to your computer and use it in GitHub Desktop.
TransferTransaction note-9
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func (w *Wallet) txTransferToOutputs(address string, txHash chainhash.Hash, account uint32, | |
minconf int32, feeSatPerKB btcutil.Amount) (tx *txauthor.AuthoredTx, err error) { | |
fmt.Printf("txTransferToOutputs... \n") | |
chainClient, err := w.requireChainClient() | |
if err != nil { | |
return nil, err | |
} | |
var txToBoTransferred wtxmgr.Credit | |
err = walletdb.View(w.db, func(dbtx walletdb.ReadTx) error { | |
// Get current block's height and hash. | |
bs, err := chainClient.BlockStamp() | |
if err != nil { | |
return err | |
} | |
// Find only the transaction with hash 'txHash' that belong to 'account' | |
// If not found any, or the found one isn't eligible, throw a relevant exception | |
// Eligible if : has 'minconf' confirmation & unspent | |
// Eventually will return only post-dated cheques | |
txToBoTransferred, err = w.findTheTransaction(dbtx, txHash, account, minconf, bs) | |
return err | |
}) | |
if err != nil { | |
return nil, err | |
} | |
fmt.Printf("Found : %d", txToBoTransferred.Amount) | |
return nil, nil | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment