display the addresse in TXIn and optmize getAddress command
This commit is contained in:
parent
01d18ce4d5
commit
5c88b24c2c
|
@ -17,14 +17,12 @@ func (cli *CLI) getAddress(pubKey string) {
|
|||
pubKeyHash := HashPubKey(public)
|
||||
|
||||
versionedPayload := append([]byte{version}, pubKeyHash...)
|
||||
checksum := checksum(versionedPayload)
|
||||
fullPayload := append(versionedPayload, checksum(versionedPayload)...)
|
||||
|
||||
fullPayload := append(versionedPayload, checksum...)
|
||||
address := Base58Encode(fullPayload)
|
||||
fmt.Println()
|
||||
fmt.Printf("PubKey : %s\n", pubKey)
|
||||
fmt.Printf("PubKeyHash : %x\n", pubKeyHash)
|
||||
fmt.Printf("Address : %s\n", address)
|
||||
fmt.Printf("Address : %s\n", Base58Encode(fullPayload))
|
||||
}
|
||||
|
||||
func (cli *CLI) getPubKeyHash(address string) {
|
||||
|
|
|
@ -94,11 +94,16 @@ func (tx Transaction) String() string {
|
|||
|
||||
for i, input := range tx.Vin {
|
||||
|
||||
pubKeyHash := HashPubKey(input.PubKey)
|
||||
versionedPayload := append([]byte{version}, pubKeyHash...)
|
||||
fullPayload := append(versionedPayload, checksum(versionedPayload)...)
|
||||
|
||||
lines = append(lines, fmt.Sprintf(" Input %d:", i))
|
||||
lines = append(lines, fmt.Sprintf(" TXID: %x", input.Txid))
|
||||
lines = append(lines, fmt.Sprintf(" Out: %d", input.Vout))
|
||||
lines = append(lines, fmt.Sprintf(" Signature: %x", input.Signature))
|
||||
lines = append(lines, fmt.Sprintf(" PubKey: %x", input.PubKey))
|
||||
lines = append(lines, fmt.Sprintf(" Addr : %s", Base58Encode(fullPayload)))
|
||||
}
|
||||
|
||||
for i, output := range tx.Vout {
|
||||
|
|
Loading…
Reference in New Issue