File tree Expand file tree Collapse file tree 1 file changed +11
-4
lines changed
internal/handshake/protocol Expand file tree Collapse file tree 1 file changed +11
-4
lines changed Original file line number Diff line number Diff line change @@ -508,14 +508,16 @@ func Get(t NetworkType) *Network {
508508 return SelectNetwork (t )
509509}
510510
511- // Ensure returns t if known, else returns Primary()
512- func Ensure (t * Network ) * Network {
513- if t != nil {
514- return t
511+ // Ensure returns n if known, else returns Primary()
512+ func Ensure (n * Network ) * Network {
513+ if n != nil {
514+ return n
515515 }
516516 return Primary ()
517517}
518518
519+ // Lookups helper functions
520+
519521// FromMagic finds a network by magic number.
520522func FromMagic (magic uint32 , prefer ... NetworkType ) * Network {
521523 if len (prefer ) > 0 {
@@ -638,3 +640,8 @@ func FromAddress(hrp string, prefer ...NetworkType) *Network {
638640func (n * Network ) String () string {
639641 return n .Type
640642}
643+
644+ // Types lists all supported network type constants.
645+ func Types () []NetworkType {
646+ return []NetworkType {Mainnet , Testnet , Regtest , Simnet }
647+ }
You can’t perform that action at this time.
0 commit comments