ipfs/kubo

namesys/routing.go imports dht package preventing dht.Quorum() from being used with a custom routing option

開放

#5,957 建立於 2019年1月30日

 (1 則留言) (0 個反應) (0 位負責人)Go (2,725 個分叉)batch import
P3effort/hoursexp/intermediatehelp wantedstatus/ready

倉庫指標

星標
 (13,906 顆星)
PR 合併指標
 (平均合併 4天 2小時) (30 天內合併 28 個 PR)

描述

If a user is using a custom routing option (like for example, we are using a modified DHT in openbazaar) and they pass in a DhtRecordCount to namesys.Resolve. The routing resolver will call dht.Quorum(int(options.DhtRecordCount)) however, the dht package imported by routing.go is the native dht package and not the one set by the user. The quorum function doesn't apply the option to the custom routing option.

func Quorum(n int) ropts.Option {
	return func(opts *ropts.Options) error {
		if opts.Other == nil {
			opts.Other = make(map[interface{}]interface{}, 1)
		}
		opts.Other[quorumOptionKey{}] = n
		return nil
	}
}

I think the issue using a struct defined inside the package for quorumOptionKey rather than, say, a string.

貢獻者指南