Skip to content

Commit

Permalink
Allow history block to contain register name tx
Browse files Browse the repository at this point in the history
Signed-off-by: Yilun <zyl.skysniper@gmail.com>
  • Loading branch information
yilunzhang committed Jul 2, 2019
1 parent 9a1d63a commit 17fa33a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
17 changes: 9 additions & 8 deletions chain/txValidator.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,14 +130,15 @@ func CheckTransactionPayload(txn *transaction.Transaction) error {
}
case pb.SIG_CHAIN_TXN_TYPE:
case pb.REGISTER_NAME_TYPE:
pld := payload.(*pb.RegisterName)
match, err := regexp.MatchString("(^[A-Za-z][A-Za-z0-9-_.+]{2,254}$)", pld.Name)
if err != nil {
return err
}
if !match {
return fmt.Errorf("name %s should start with a letter, contain A-Za-z0-9-_.+ and have length 3-255", pld.Name)
}
return errors.New("Register name transaction is not supported yet")
// pld := payload.(*pb.RegisterName)
// match, err := regexp.MatchString("(^[A-Za-z][A-Za-z0-9-_.+]{2,254}$)", pld.Name)
// if err != nil {
// return err
// }
// if !match {
// return fmt.Errorf("name %s should start with a letter, contain A-Za-z0-9-_.+ and have length 3-255", pld.Name)
// }
case pb.DELETE_NAME_TYPE:
case pb.SUBSCRIBE_TYPE:
pld := payload.(*pb.Subscribe)
Expand Down
4 changes: 2 additions & 2 deletions transaction/payload.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ func Unpack(payload *pb.Payload) (IPayload, error) {
pl = new(pb.TransferAsset)
case pb.SIG_CHAIN_TXN_TYPE:
pl = new(pb.SigChainTxn)
// case pb.REGISTER_NAME_TYPE:
// pl = new(pb.RegisterName)
case pb.REGISTER_NAME_TYPE:
pl = new(pb.RegisterName)
case pb.DELETE_NAME_TYPE:
pl = new(pb.DeleteName)
case pb.SUBSCRIBE_TYPE:
Expand Down

0 comments on commit 17fa33a

Please sign in to comment.