(pubkeys []ed25519.PublicKey, nSigs int, timestamp time.Time)
| 240 | } |
| 241 | |
| 242 | func NewInitialBlock(pubkeys []ed25519.PublicKey, nSigs int, timestamp time.Time) (*legacy.Block, error) { |
| 243 | // TODO(kr): move this into a lower-level package (e.g. chain/protocol/bc) |
| 244 | // so that other packages (e.g. chain/protocol/validation) unit tests can |
| 245 | // call this function. |
| 246 | |
| 247 | script, err := vmutil.BlockMultiSigProgram(pubkeys, nSigs) |
| 248 | if err != nil { |
| 249 | return nil, err |
| 250 | } |
| 251 | |
| 252 | root, err := bc.MerkleRoot(nil) // calculate the zero value of the tx merkle root |
| 253 | if err != nil { |
| 254 | return nil, errors.Wrap(err, "calculating zero value of tx merkle root") |
| 255 | } |
| 256 | |
| 257 | b := &legacy.Block{ |
| 258 | BlockHeader: legacy.BlockHeader{ |
| 259 | Version: 1, |
| 260 | Height: 1, |
| 261 | TimestampMS: bc.Millis(timestamp), |
| 262 | BlockCommitment: legacy.BlockCommitment{ |
| 263 | TransactionsMerkleRoot: root, |
| 264 | ConsensusProgram: script, |
| 265 | }, |
| 266 | }, |
| 267 | } |
| 268 | return b, nil |
| 269 | } |
no outgoing calls