(input *Input, txIn bc.Input, tx *bc.Tx, logPos int)
| 205 | } |
| 206 | |
| 207 | func addInputMeta(input *Input, txIn bc.Input, tx *bc.Tx, logPos int) { |
| 208 | // expect refdata log after an account-spending input: |
| 209 | if logPos+1 >= len(tx.Log) { |
| 210 | return |
| 211 | } |
| 212 | spendRefTuple := tx.Log[logPos+1] |
| 213 | seed := spendRefTuple[1].(txvm.Bytes) |
| 214 | if !bytes.Equal(seed, standard.PayToMultisigSeed1[:]) && !bytes.Equal(seed, standard.PayToMultisigSeed2[:]) { |
| 215 | return |
| 216 | } |
| 217 | spendRefdata := []byte(spendRefTuple[2].(txvm.Bytes)) |
| 218 | |
| 219 | quorumTuple := txIn.Stack[0].(txvm.Tuple) |
| 220 | if len(quorumTuple) != 2 { |
| 221 | return |
| 222 | } |
| 223 | if quorumTuple[0].(txvm.Bytes)[0] != txvm.IntCode { |
| 224 | return |
| 225 | } |
| 226 | input.Quorum = int(quorumTuple[1].(txvm.Int)) |
| 227 | |
| 228 | pubkeyTupleTuple := txIn.Stack[1].(txvm.Tuple) |
| 229 | if len(pubkeyTupleTuple) != 2 { |
| 230 | return |
| 231 | } |
| 232 | if pubkeyTupleTuple[0].(txvm.Bytes)[0] != txvm.TupleCode { |
| 233 | return |
| 234 | } |
| 235 | pubkeyTuple := pubkeyTupleTuple[1].(txvm.Tuple) |
| 236 | for _, p := range pubkeyTuple { |
| 237 | if pubkey, ok := p.(txvm.Bytes); ok { |
| 238 | input.Pubkeys = append(input.Pubkeys, ed25519.PublicKey(pubkey)) |
| 239 | } else { |
| 240 | return |
| 241 | } |
| 242 | } |
| 243 | |
| 244 | val := txIn.Stack[2].(txvm.Tuple) |
| 245 | input.Value = &Value{ |
| 246 | Amount: uint64(val[1].(txvm.Int)), |
| 247 | AssetID: bc.HashFromBytes(val[2].(txvm.Bytes)), |
| 248 | Anchor: val[3].(txvm.Bytes), |
| 249 | } |
| 250 | input.RefData = spendRefdata |
| 251 | } |
| 252 | |
| 253 | func addIssueMeta(issuance *Issuance, txIss bc.Issuance, tx *bc.Tx, logPos int) { |
| 254 | if logPos < 2 || logPos+1 >= len(tx.Log) { |
no test coverage detected